diff --git a/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java b/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java index 10ac3a9..5074b03 100644 --- a/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java +++ b/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java @@ -201,7 +201,10 @@ public boolean shouldProceed(boolean red, boolean lastredstone) { Future job; ICraftingLink link; + int interval=1; + int interval_count=0; int reqcooldown; + public void requestForMissing(IAEStack primitive) { if (upgrade[1] == null) return; @@ -260,6 +263,17 @@ public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) inv.clear(); return TickRateModulation.SAME; } + + interval_count++; + if(interval_count>=interval){ + interval_count=0; + } else{ + return TickRateModulation.SAME; + } + + + + if (getProxy().isActive() == false) return TickRateModulation.SAME; for (StorageChannel ch : new StorageChannel[] { StorageChannel.FLUIDS, StorageChannel.ITEMS }) { IMEInventory inv = getInv(ch); @@ -329,6 +343,7 @@ public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) Actionable.SIMULATE, source); long missing = -amount + expected - (take == null ? 0 : take.getStackSize()); + if (missing > 0) requestForMissing( is.copy() .setStackSize(missing)); @@ -712,6 +727,23 @@ public int getSlotLimit(int slot) { }.setPos(60 + 40, 3 + 20) .addTooltip(StatCollector.translateToLocal("proghatches.amountmaintainer.craftcard"))); + + builder.widget( + new NumericWidget().setSetter(val -> interval = (int) val) + .setGetter(() -> interval) + .setBounds(1, 400) + .setScrollValues(1, 4, 64) + .setTextAlignment(Alignment.Center) + .setTextColor(Color.WHITE.normal) + .setSize(40, 18) + .setPos(60 + 18+40, 3+20) + .setBackground(GTUITextures.BACKGROUND_TEXT_FIELD) + .addTooltips( + Arrays.asList( + StatCollector.translateToLocal("proghatches.amountmaintainer.interval.0") + ) + + )); return builder.build(); } @@ -765,6 +797,10 @@ public void readFromNBT(NBTTagCompound data) { mode = data.getInteger("mode"); rsmode = data.getInteger("rsmode"); redstone = data.getInteger("redstone"); + interval=data.getInteger("interval"); + if(interval<1){interval=1;} + interval_count=data.getInteger("interval_count"); + amount = data.getLong("amount"); lastredstone = data.getBoolean("lastredstone"); mark[0] = ItemStack.loadItemStackFromNBT(data.getCompoundTag("mark")); @@ -806,6 +842,10 @@ public void writeToNBT(NBTTagCompound data) { data.setInteger("mode", mode); data.setInteger("rsmode", rsmode); data.setInteger("redstone", redstone); + data.setInteger("interval", interval); + data.setInteger("interval_count", interval_count); + + data.setLong("amount", amount); data.setBoolean("lastredstone", lastredstone); if (mark[0] != null) { diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java index 0ca0620..8679d20 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java @@ -609,8 +609,8 @@ public String getName() { StringBuilder name = new StringBuilder(); name.append( - m.getMachineCraftingIcon() - .getDisplayName()); + Optional.ofNullable(m.getMachineCraftingIcon()).map(s->s.getDisplayName()+"(Mapped)") + .orElse(m.getLocalName()==null?"":m.getLocalName()+"(Mapped)")); if (m.mInventory[m.getCircuitSlot()] != null) { name.append(" - "); ItemStack is = m.mInventory[m.getCircuitSlot()]; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputBus.java b/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputBus.java index 04334e6..6ae4832 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputBus.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputBus.java @@ -33,7 +33,9 @@ import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import appeng.api.util.DimensionalCoord; import appeng.util.Platform; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTechAPI; @@ -159,10 +161,24 @@ public void saveNBTData(NBTTagCompound compound) { public boolean dump(ItemStack aStack) { boolean b = filterPredicate.test(aStack); - if (b && fx) MyMod.net.sendToDimension( + if (b && fx) + MyMod.net.sendToAllAround( + + + new VoidFXMessage(this.getBaseMetaTileEntity(), aStack), - this.getBaseMetaTileEntity() - .getWorld().provider.dimensionId); + new TargetPoint( this.getBaseMetaTileEntity().getWorld().provider.dimensionId, + this.getBaseMetaTileEntity().getXCoord(), + this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord(), + 64 + ) + ); + + + + + return b; } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputHatch.java index 3d4c6c4..53829d8 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/VoidOutputHatch.java @@ -26,6 +26,7 @@ import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTechAPI; @@ -40,429 +41,376 @@ public class VoidOutputHatch extends MTEHatchOutput { - public VoidOutputHatch(String mName, byte mTier, String[] mDescriptionArray, ITexture[][][] mTextures) { - super(mName, mTier, 0, mDescriptionArray, mTextures); - - } - - FluidStack[] filter = new FluidStack[16]; - - Predicate filterPredicate = (s) -> false; - - public void rebuildFilter() { - filterPredicate = (s) -> false; - for (FluidStack is : filter) { - if (is != null) { - filterPredicate = filterPredicate.or( - s -> { - return s != null && is.getFluid() - .equals(s.getFluid()); - }); - } - - } - } - - @Override - public void addUIWidgets(Builder builder, UIBuildContext buildContext) { - - for (int ii = 0; ii < 16; ii++) { - final int i = ii; - builder.widget(FluidSlotWidget.phantom(new MappingFluidTank(s -> { - filter[i] = s == null ? null : s.copy(); - rebuildFilter(); - }, () -> filter[i]), false) - .setPos(3 + (i % 4) * 16, 3 + (i / 4) * 16)); - - ; - } - - /* - * builder .widget( - * SlotGroup.ofItemHandler(handler, 4).startFromSlot(0).endAtSlot(15) - * .background(getGUITextureSet().getItemSlot()) - * .slotCreator(i -> new BaseSlot(handler, i, true) { - * @Override - * public ItemStack getStack() { - * return isEnabled() ? super.getStack() : null; - * } - * }).build().setPos(7, 24)); - */ - } - - public VoidOutputHatch(int aID, String aName, String aNameRegional, int tier) { - super( - aID, - aName, - aNameRegional, - tier, - - reobf.proghatches.main.Config.get("VOH", ImmutableMap.of()) - - , - 0 - - ); - - Registration.items.add(new ItemStack(GregTechAPI.sBlockMachines, 1, aID)); - } - - @Override - public VoidOutputHatch newMetaEntity(IGregTechTileEntity aTileEntity) { - - return new VoidOutputHatch(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public void loadNBTData(NBTTagCompound compound) { - super.loadNBTData(compound); - NBTTagList nbttaglist = compound.getTagList("Items", 10); - Arrays.fill(this.filter, null); - - for (int i = 0; i < nbttaglist.tagCount(); ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 255; - - if (j >= 0 && j < this.filter.length) { - this.filter[j] = FluidStack.loadFluidStackFromNBT(nbttagcompound1); - } - } - - NBTTagList nbttaglist0 = compound.getTagList("Fluids", 10); - rebuildFilter(); - if (compound.hasKey("fx")) fx = compound.getBoolean("fx"); - } - - @Override - public void saveNBTData(NBTTagCompound compound) { - super.saveNBTData(compound); - NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.filter.length; ++i) { - if (this.filter[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - this.filter[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - - compound.setTag("Items", nbttaglist); - nbttaglist = new NBTTagList(); - compound.setBoolean("fx", fx); - - } - - public boolean dump(FluidStack aStack) { - boolean b = filterPredicate.test(aStack); - - if (b && fx) MyMod.net.sendToDimension( - new VoidFXMessage(this.getBaseMetaTileEntity(), aStack), - this.getBaseMetaTileEntity() - .getWorld().provider.dimensionId); - - return b; - } - - public boolean outputsSteam() { - return false; - } - - public boolean outputsLiquids() { - return false; - } - - public boolean outputsItems() { - return false; - } - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @SideOnly(Side.CLIENT) - long remainticks; - @SideOnly(Side.CLIENT) - LinkedList types; - - @SideOnly(Side.CLIENT) - public void addVisual(FluidStack f) { - if (types == null) types = new LinkedList<>(); - remainticks = 40;// (f.amount); - types.add(f); - if (types.size() > 20) types.removeLast(); - } - - @Override - @SideOnly(Side.CLIENT) - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (types == null) types = new LinkedList<>(); - /* - * 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(); - return; - } - /* - * for(long k=1;kk*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(); - } - } - } - - @Override - public void renderParticle(Tessellator tess, float timeStep, float rotationX, float rotationXZ, float rotationZ, - float rotationYZ, float rotationXY) { - double x = (this.prevPosX + (this.posX - this.prevPosX) * timeStep - interpPosX); - double y = (this.prevPosY + (this.posY - this.prevPosY) * timeStep - interpPosY); - double z = (this.prevPosZ + (this.posZ - this.prevPosZ) * timeStep - interpPosZ); - - float minU = this.particleTextureIndexX / 16.0F; - float maxU = minU + 0.0624375F; - float minV = this.particleTextureIndexY / 16.0F; - float maxV = minV + 0.0624375F; - float scale = 0.1F * this.particleScale; - - if (this.particleIcon != null) { - minU = this.particleIcon.getMinU(); - maxU = this.particleIcon.getMaxU(); - minV = this.particleIcon.getMinV(); - maxV = this.particleIcon.getMaxV(); - } - - tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - - for (int i = 0; i < 5; i++) { - renderParticle( - tess, - x, - y, - z, - rotationX, - rotationXZ, - rotationZ, - rotationYZ, - rotationXY, - minU, - maxU, - minV, - maxV, - scale); - } - } - - private void renderParticle(Tessellator tess, double x, double y, double z, float rotationX, float rotationXZ, - float rotationZ, float rotationYZ, float rotationXY, float minU, float maxU, float minV, float maxV, - float scale) { - tess.addVertexWithUV( - (x - rotationX * scale - rotationYZ * scale), - (y - rotationXZ * scale), - (z - rotationZ * scale - rotationXY * scale), - maxU, - maxV); - tess.addVertexWithUV( - (x - rotationX * scale + rotationYZ * scale), - (y + rotationXZ * scale), - (z - rotationZ * scale + rotationXY * scale), - maxU, - minV); - tess.addVertexWithUV( - (x + rotationX * scale + rotationYZ * scale), - (y + rotationXZ * scale), - (z + rotationZ * scale + rotationXY * scale), - minU, - minV); - tess.addVertexWithUV( - (x + rotationX * scale - rotationYZ * scale), - (y - rotationXZ * scale), - (z + rotationZ * scale - rotationXY * scale), - minU, - maxV); - } - - } - - boolean fx = true; - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ, - ItemStack aTool) { - - if (!getBaseMetaTileEntity().getCoverInfoAtSide(side) - .isGUIClickable()) return; - fx = !fx; - GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("proghatches.gt.void.fx." + fx)); - - } + public VoidOutputHatch(String mName, byte mTier, String[] mDescriptionArray, ITexture[][][] mTextures) { + super(mName, mTier, 0, mDescriptionArray, mTextures); + + } + + FluidStack[] filter = new FluidStack[16]; + + Predicate filterPredicate = (s) -> false; + + public void rebuildFilter() { + filterPredicate = (s) -> false; + for (FluidStack is : filter) { + if (is != null) { + filterPredicate = filterPredicate.or(s -> { + return s != null && is.getFluid().equals(s.getFluid()); + }); + } + + } + } + + @Override + public void addUIWidgets(Builder builder, UIBuildContext buildContext) { + + for (int ii = 0; ii < 16; ii++) { + final int i = ii; + builder.widget(FluidSlotWidget.phantom(new MappingFluidTank(s -> { + filter[i] = s == null ? null : s.copy(); + rebuildFilter(); + }, () -> filter[i]), false).setPos(3 + (i % 4) * 16, 3 + (i / 4) * 16)); + + ; + } + + /* + * builder .widget( SlotGroup.ofItemHandler(handler, + * 4).startFromSlot(0).endAtSlot(15) + * .background(getGUITextureSet().getItemSlot()) .slotCreator(i -> new + * BaseSlot(handler, i, true) { + * + * @Override public ItemStack getStack() { return isEnabled() ? + * super.getStack() : null; } }).build().setPos(7, 24)); + */ + } + + public VoidOutputHatch(int aID, String aName, String aNameRegional, int tier) { + super(aID, aName, aNameRegional, tier, + + reobf.proghatches.main.Config.get("VOH", ImmutableMap.of()) + + , 0 + + ); + + Registration.items.add(new ItemStack(GregTechAPI.sBlockMachines, 1, aID)); + } + + @Override + public VoidOutputHatch newMetaEntity(IGregTechTileEntity aTileEntity) { + + return new VoidOutputHatch(mName, mTier, mDescriptionArray, mTextures); + } + + @Override + public void loadNBTData(NBTTagCompound compound) { + super.loadNBTData(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + Arrays.fill(this.filter, null); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < this.filter.length) { + this.filter[j] = FluidStack.loadFluidStackFromNBT(nbttagcompound1); + } + } + + NBTTagList nbttaglist0 = compound.getTagList("Fluids", 10); + rebuildFilter(); + if (compound.hasKey("fx")) + fx = compound.getBoolean("fx"); + } + + @Override + public void saveNBTData(NBTTagCompound compound) { + super.saveNBTData(compound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.filter.length; ++i) { + if (this.filter[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + this.filter[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + compound.setTag("Items", nbttaglist); + nbttaglist = new NBTTagList(); + compound.setBoolean("fx", fx); + + } + + public boolean dump(FluidStack aStack) { + boolean b = filterPredicate.test(aStack); + + if (b && fx) + MyMod.net.sendToAllAround( + + new VoidFXMessage(this.getBaseMetaTileEntity(), aStack), + new TargetPoint(this.getBaseMetaTileEntity().getWorld().provider.dimensionId, + this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord(), 64)); + + return b; + } + + public boolean outputsSteam() { + return false; + } + + public boolean outputsLiquids() { + return false; + } + + public boolean outputsItems() { + return false; + } + + @Override + public boolean doesFillContainers() { + return false; + } + + @Override + public boolean doesEmptyContainers() { + return false; + } + + @SideOnly(Side.CLIENT) + long remainticks; + @SideOnly(Side.CLIENT) + LinkedList types; + + @SideOnly(Side.CLIENT) + public void addVisual(FluidStack f) { + if (types == null) + types = new LinkedList<>(); + remainticks = 40;// (f.amount); + types.add(f); + if (types.size() > 20) + types.removeLast(); + } + + @Override + @SideOnly(Side.CLIENT) + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (types == null) + types = new LinkedList<>(); + /* + * 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(); + return; + } + /* + * for(long k=1;kk*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(); + } + } + } + + @Override + public void renderParticle(Tessellator tess, float timeStep, float rotationX, float rotationXZ, float rotationZ, + float rotationYZ, float rotationXY) { + double x = (this.prevPosX + (this.posX - this.prevPosX) * timeStep - interpPosX); + double y = (this.prevPosY + (this.posY - this.prevPosY) * timeStep - interpPosY); + double z = (this.prevPosZ + (this.posZ - this.prevPosZ) * timeStep - interpPosZ); + + float minU = this.particleTextureIndexX / 16.0F; + float maxU = minU + 0.0624375F; + float minV = this.particleTextureIndexY / 16.0F; + float maxV = minV + 0.0624375F; + float scale = 0.1F * this.particleScale; + + if (this.particleIcon != null) { + minU = this.particleIcon.getMinU(); + maxU = this.particleIcon.getMaxU(); + minV = this.particleIcon.getMinV(); + maxV = this.particleIcon.getMaxV(); + } + + tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + + for (int i = 0; i < 5; i++) { + renderParticle(tess, x, y, z, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY, minU, maxU, + minV, maxV, scale); + } + } + + private void renderParticle(Tessellator tess, double x, double y, double z, float rotationX, float rotationXZ, + float rotationZ, float rotationYZ, float rotationXY, float minU, float maxU, float minV, float maxV, + float scale) { + tess.addVertexWithUV((x - rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), + (z - rotationZ * scale - rotationXY * scale), maxU, maxV); + tess.addVertexWithUV((x - rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), + (z - rotationZ * scale + rotationXY * scale), maxU, minV); + tess.addVertexWithUV((x + rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), + (z + rotationZ * scale + rotationXY * scale), minU, minV); + tess.addVertexWithUV((x + rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), + (z + rotationZ * scale - rotationXY * scale), minU, maxV); + } + + } + + boolean fx = true; + + @Override + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ, + ItemStack aTool) { + + if (!getBaseMetaTileEntity().getCoverInfoAtSide(side).isGUIClickable()) + return; + fx = !fx; + GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("proghatches.gt.void.fx." + fx)); + + } } diff --git a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java index b43d14f..7a40732 100644 --- a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java +++ b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java @@ -2055,6 +2055,19 @@ public void run() { .eut(30) .addTo(RecipeMaps.assemblerRecipes); + GTValues.RA.stdBuilder() + .itemInputs( + ItemList.Tool_DataOrb.get(1) + , + GregtechItemList.Hatch_Input_Elemental_Duplicator.get(1) + ) + .itemOutputs( new ItemStack( + GregTechAPI.sBlockMachines, + 1, + Config.metaTileEntityOffset + Registration.DataOrbOffset)) + .duration(1 * SECONDS) + .eut(30) + .addTo(RecipeMaps.assemblerRecipes); /* * rec = new ShapelessOreRecipe( new ItemStack( MyMod.plunger,1,1), * ItemEnum.BOOSTER_CARD.getStack(0), diff --git a/src/main/java/reobf/proghatches/net/VoidFXMessage.java b/src/main/java/reobf/proghatches/net/VoidFXMessage.java index 2205392..0519e21 100644 --- a/src/main/java/reobf/proghatches/net/VoidFXMessage.java +++ b/src/main/java/reobf/proghatches/net/VoidFXMessage.java @@ -56,7 +56,7 @@ public VoidFXMessage onMessage(VoidFXMessage message, MessageContext ctx) { ; } catch (Exception e) { - e.printStackTrace(); + //e.printStackTrace(); } else try { ((VoidOutputBus) ((IGregTechTileEntity) Minecraft.getMinecraft().theWorld @@ -64,11 +64,11 @@ public VoidFXMessage onMessage(VoidFXMessage message, MessageContext ctx) { ; } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); } } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); } return null; diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index 6cfe447..271cf6d 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -544,7 +544,7 @@ proghatches.amountmaintainer.craftcard=Put Crafting Card to auto-request for mis proghatches.submitter.state.0=§3Idle proghatches.submitter.state.1=§cFailed proghatches.submitter.state.2=§aSubmitted -hatch.input.dual.oc=Programmable Dual Input Hub(ME) +hatch.input.dual.oc=Programmable Dual Input Hub (ME) tile.proghatches.card_reader.name=Sensor Card Reader proghatch.eucrafting.warn=§cExperimental item! Disabled by default, turn on Mixin in config to make it work. tile.reactor_syncer.tooltip.0=Output redstone signal accroding to IC2 Nuclear Reactor update ticker. @@ -554,7 +554,7 @@ tile.reactor_syncer.tooltip.3=Better use Redstone P2P, Redstone Conduit or Redal tile.reactor_syncer.tooltip=4 tile.proghatch.reactor_syncer.name=Reactor Update Synchronizer hatch.dualinput.slave.inv.mapping.name=Dual Inventory Mapping Slave -hatch.dualinput.slave.inv.mapping.me.name=Dual Inventory Mapping Slave(ME) +hatch.dualinput.slave.inv.mapping.me.name=Dual Inventory Mapping Slave (ME) programmable_hatches.gt.pattern.mapping=Insert Pattern(ME Mapping Slave) hatch.dualinput.slave.inv.mapping.me.missing=Not Linked programmable_hatches.cover.me.drop=Cover is dropped, please re-attach it to update ME Network info. @@ -595,10 +595,10 @@ programmable_hatches.gt.fluidlimit.neo.1=Limiting: Only fill slot of same fluid, programmable_hatches.gt.fluidlimit.neo.2=Empty first: Fill empty fluid slots first, then try Nomal mode. proghatches.decoy.reservefirst.enabled=Reserve the first slot for inventory of highest priority: true proghatches.decoy.reservefirst.disabled=Reserve the first slot for inventory of highest priority: false -fluid.input.bus.me.decoy.name=Assline Decoy Stocking Input Bus(ME) -fluid.input.me.decoy.name=Assline Decoy Stocking Input Hatch(ME) -fluid.input.bus.me.pfilter.name=Priority Filtering Stocking Input Bus(ME) -fluid.input.me.pfilter.name=Priority Filtering Stocking Input Hatch(ME) +fluid.input.bus.me.decoy.name=Assline Decoy Stocking Input Bus (ME) +fluid.input.me.decoy.name=Assline Decoy Stocking Input Hatch (ME) +fluid.input.bus.me.pfilter.name=Priority Filtering Stocking Input Bus (ME) +fluid.input.me.pfilter.name=Priority Filtering Stocking Input Hatch (ME) proghatches.priority.filter=Auto-pull priority filter proghatch.proxy.disable=Disabled proghatch.proxy.Strict=Strict Match @@ -726,8 +726,8 @@ tile.proghatches.autofillerMKII.tooltip.0=Besides normal Auto Filler behaviour, tile.proghatches.autofillerMKII.tooltip.1=Infinite parallels. achievement.proghatch.toolkit=Try equipping this on Baubles Slot! achievement.proghatch.toolkit.desc=Then bind a key in settings to switch mode! -output.bus.storage.name=Storage Output Bus(ME) -output.hacth.storage.name=Storage Output Hatch(ME) +output.bus.storage.name=Storage Output Bus (ME) +output.hacth.storage.name=Storage Output Hatch (ME) item.proghatches.emitterpattern.name=Emitting Encoded Pattern tile.proghatches.request_tunnel.name=Crafting Request Tunnel item.emitterpattern.name.tooltip.0=A special pattern without inputs. Click RMB when not stacked to configure outputs. @@ -747,7 +747,7 @@ programmable_hatches.gt.newcrib.5=When off, GT Multi is not allowed to cache rec programmable_hatches.gt.newcrib.nosupport=§cNot supported on current GT5u item.proghatches.part.tunnel.name=Crafting Request Tunnel provider.water.name=Water Provider -input.focus.me.name=Automatable Focus Input Bus(ME) +input.focus.me.name=Automatable Focus Input Bus (ME) input.dataorb.name=Automatable Data Orb Repository proghatches.orb_switcher.nbt.mode.0=Match NBT: false proghatches.orb_switcher.nbt.mode.1=Match NBT: true @@ -760,5 +760,6 @@ proghatch.orb_switcher.tooltip.3=Turn the front side with a wrench to a GT Blcok proghatch.orb_switcher.tooltip.4=Then this device will maintain Target ME Network proghatch.orb_switcher.tooltip.5=to make sure it only has one item same as the one in circuit slot. proghatch.orb_switcher.tooltip.6=Hint: use this to automate Power Plant Catalyst/Target Chamer Foci/Element Orb Hatch -input.catalyst.me.name=Automatable Catalyst Housing(ME) +input.catalyst.me.name=Automatable Catalyst Housing (ME) tile.proghatches.orb_switcher.name=Catalyst Item Switcher(WIP) +proghatches.amountmaintainer.interval.0=Update interval in tick(s) diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index 51420f3..5585c4d 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -760,3 +760,4 @@ proghatch.orb_switcher.tooltip.5=维持目标网络中物品,为数量为1的电 proghatch.orb_switcher.tooltip.6=提示:用于自动化化工厂催化剂/靶仓聚焦物品/元素数据球仓 input.catalyst.me.name=自动化催化剂仓(ME) tile.proghatches.orb_switcher.name=催化剂物品切换器(WIP) +proghatches.amountmaintainer.interval.0=更新间隔(单位tick)