Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Nov 7, 2024
1 parent 974a97f commit ad4845c
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/main/java/reobf/proghatches/ae/PartStorageProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,9 @@ public boolean onPartActivate(EntityPlayer player, Vec3 pos) {

return true;
}

@Override
public void gridChanged() {
internal.gridChanged();
super.gridChanged();
}
}
2 changes: 1 addition & 1 deletion src/main/java/reobf/proghatches/ae/PartSubnetExciter.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public boolean requireDynamicRender() {
public void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer) {
super.renderDynamic(x, y, z, rh, renderer);
if(prevok==true&&ok==false){
if( Minecraft.getMinecraft().isGamePaused()){return;}
for(int i=0;i<16;i++)
Minecraft.getMinecraft().theWorld.spawnParticle("smoke",
this.getHost().getTile().xCoord+0.5+this.getSide().offsetX*0.5
Expand Down
220 changes: 218 additions & 2 deletions src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputHatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,41 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ParticleFX;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.common.GT_Client;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityDropParticleFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import reobf.proghatches.block.ChunkTrackingGridCahce;
import reobf.proghatches.block.IChunkTrackingGridCahce;
import reobf.proghatches.gt.metatileentity.util.MappingFluidTank;
import reobf.proghatches.main.MyMod;
import reobf.proghatches.main.registration.Registration;
import reobf.proghatches.net.VoidFXMessage;
import reobf.proghatches.net.WayPointMessage;
import reobf.proghatches.util.ProghatchesUtil;

public class VoidOutputHatch extends GT_MetaTileEntity_Hatch_Output {
Expand Down Expand Up @@ -147,7 +160,7 @@ public void loadNBTData(NBTTagCompound compound) {
}

NBTTagList nbttaglist0 = compound.getTagList("Fluids", 10);

rebuildFilter();
}

@Override
Expand All @@ -173,8 +186,14 @@ public void saveNBTData(NBTTagCompound compound) {
}

public boolean dump(FluidStack aStack) {
return filterPredicate.test(aStack);
boolean b= filterPredicate.test(aStack);


if(b)MyMod.net.sendToDimension(new VoidFXMessage(
this.getBaseMetaTileEntity(), aStack
),this.getBaseMetaTileEntity().getWorld().provider.dimensionId);

return b;
}
public boolean outputsSteam() {
return false;
Expand All @@ -197,5 +216,202 @@ public boolean doesFillContainers() {
public boolean doesEmptyContainers() {
return false;
}



@SideOnly(Side.CLIENT)
long remainticks;
@SideOnly(Side.CLIENT)
LinkedList<FluidStack> types=new LinkedList<>();
@SideOnly(Side.CLIENT)
public void addVisual(FluidStack f){
remainticks=40;//(f.amount);
types.add(f);
if(types.size()>20)types.removeLast();
}
@Override@SideOnly(Side.CLIENT)
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {

/*MyMod.net.sendToDimension(new VoidFXMessage(
this.getBaseMetaTileEntity(), new FluidStack(FluidRegistry.LAVA, 1000)
),this.getBaseMetaTileEntity().getWorld().provider.dimensionId);
try{
MyMod.net.sendToDimension(new VoidFXMessage(
this.getBaseMetaTileEntity(), new FluidStack(FluidRegistry.getFluid("liquid_drillingfluid"), 1000)
),this.getBaseMetaTileEntity().getWorld().provider.dimensionId);
}catch(Exception e){}
*/
if(remainticks>0&&aBaseMetaTileEntity.getWorld().isRemote){
//System.out.println("ss");
remainticks--;
if(remainticks==0)types.clear();
/*for(long k=1;k<Integer.MAX_VALUE;k=k*100)
if(remainticks>k*100){
remainticks-=k;
}*/

FluidStack f=types.get((int) (types.size()*Math.random()));
int col=f.getFluid().getColor();
ForgeDirection fc = aBaseMetaTileEntity.getFrontFacing();
EntityDropParticleFX fx=new EntityDropParticleFX(Minecraft.getMinecraft().theWorld,

aBaseMetaTileEntity.getXCoord()+0.5D+(fc.offsetX)*0.51f,
aBaseMetaTileEntity.getYCoord()+0.5D+(fc.offsetY)*0.51f,
aBaseMetaTileEntity.getZCoord()+0.5D+(fc.offsetZ)*0.51f,
f.getFluid());
fx.motionX=(fc.offsetX)*0.3+(Math.random()-Math.random())*0.1;
fx.motionY=(fc.offsetY)*0.3+(Math.random()-Math.random())*0.1;
fx.motionZ=(fc.offsetZ)*0.3+(Math.random()-Math.random())*0.1;



Minecraft.getMinecraft().effectRenderer.addEffect((EntityFX)fx);



}




super.onPreTick(aBaseMetaTileEntity, aTick);
}


@SideOnly(Side.CLIENT)
public class EntityDropParticleFX extends EntityFX
{
/** the material type for dropped items/blocks */
private Material materialType;
/** The height of the current bob */
private int bobTimer;
//private static final String __OBFID = "CL_00000901";

public EntityDropParticleFX(World worldIn, double p_i1203_2_, double p_i1203_4_, double p_i1203_6_, Fluid f)
{
super(worldIn, p_i1203_2_, p_i1203_4_, p_i1203_6_, 0.0D, 0.0D, 0.0D);
this.motionX = this.motionY = this.motionZ = 0.0D;

int col=f.
getColor();
this.particleBlue=col&0xFF;
this.particleGreen=(col&0xFF00)>>8;
this.particleRed=(col&0xFF0000)>>16;

this.particleBlue=0xFF;
this.particleGreen=0xFF;
this.particleRed=0xFF;

setParticleIcon(f.getIcon());

// this.setParticleTextureIndex(113);
this.setSize(0.01F, 0.01F);
this.particleGravity = 0.06F;
//this.materialType = p_i1203_8_;
this.bobTimer = 00;
this.particleMaxAge = (int)(64.0D / (Math.random() * 0.8D + 0.2D));
this.motionX = this.motionY = this.motionZ = 0.0D;
particleMaxAge=100;
}
@Override
public int getFXLayer() {
return 1;
}
public int getBrightnessForRender(float p_70070_1_)
{
return this.materialType == Material.water ? super.getBrightnessForRender(p_70070_1_) : 257;
}

/**
* Gets how bright this entity is.
*/
public float getBrightness(float p_70013_1_)
{
return this.materialType == Material.water ? super.getBrightness(p_70013_1_) : 1.0F;
}

/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;

/* if (this.materialType == Material.water)
{
this.particleRed = 0.2F;
this.particleGreen = 0.3F;
this.particleBlue = 1.0F;
}
else
{
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8);
}
*/
this.motionY -= (double)this.particleGravity;

if (this.bobTimer-- > 0)
{
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
//this.setParticleTextureIndex(113);
// this.setParticleTextureIndex(19 + this.rand.nextInt(4));
}
else
{
// this.setParticleTextureIndex(113);
//this.setParticleTextureIndex(19 + this.rand.nextInt(4));
}

this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;

if (this.particleMaxAge-- <= 0)
{
this.setDead();
}

if (this.onGround)
{
/*if (this.materialType == Material.water)
{
else
{
this.setParticleTextureIndex(114);
}
*/
// this.setDead();
//this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);

this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}

Material material = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial();

if (material.isLiquid() || material.isSolid())
{
double d0 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))));

if (this.posY < d0)
{
this.setDead();
}
}
}}





}

3 changes: 3 additions & 0 deletions src/main/java/reobf/proghatches/main/MyMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
import reobf.proghatches.net.PriorityMessage;
import reobf.proghatches.net.RenameMessage;
import reobf.proghatches.net.UpgradesMessage;
import reobf.proghatches.net.VoidFXMessage;
import reobf.proghatches.net.WayPointMessage;
import reobf.proghatches.oc.ItemAPICard;
import reobf.proghatches.oc.ItemGTRedstoneCard;
Expand Down Expand Up @@ -276,6 +277,8 @@ public void preInit(FMLPreInitializationEvent event) {
net.registerMessage(new UpgradesMessage.Handler(), UpgradesMessage.class, 3, Side.CLIENT);
net.registerMessage(new MasterSetMessage.Handler(), MasterSetMessage.class, 4, Side.CLIENT);
net.registerMessage(new WayPointMessage.Handler(), WayPointMessage.class, 5, Side.CLIENT);
net.registerMessage(new VoidFXMessage.Handler(), VoidFXMessage.class, 6, Side.CLIENT);

proxy.preInit(event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ public void addOutput(ItemStack aStack,CallbackInfoReturnable<Boolean> a)
}
lastNoVoidBusTick=thisTick;
for(GT_MetaTileEntity_Hatch_OutputBus xx:GT_Utility.filterValidMTEs(mOutputBusses)){
lastNoVoidBusTick=-1;
if(xx instanceof VoidOutputBus){
if(((VoidOutputBus)xx).dump(aStack)){
a.setReturnValue(true);//if it accepts...
return;
};
lastNoVoidBusTick=-1;

}

};
Expand All @@ -63,11 +64,12 @@ public void addOutput(FluidStack aStack,CallbackInfoReturnable<Boolean> a)
lastNoVoidHatchTick=thisTick;
for(GT_MetaTileEntity_Hatch_Output xx:GT_Utility.filterValidMTEs(mOutputHatches)){
if(xx instanceof VoidOutputHatch){
lastNoVoidHatchTick=-1;
if(((VoidOutputHatch)xx).dump(aStack)){
a.setReturnValue(true);
return;
};
lastNoVoidHatchTick=-1;

}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,12 @@ public void run() {

);

/* new VoidOutputHatch(
new VoidOutputHatch(
Config.metaTileEntityOffset + VHatch,
"void.hatch",
LangManager.translateToLocalFormatted("void.hatch.name"), 5

);*/
);
/*for (int i = 0; i < 4; i++) {
new DualInputHatch(
Expand Down
Loading

0 comments on commit ad4845c

Please sign in to comment.