Skip to content

Commit

Permalink
Made sure IE's fluids always stitch into the sheet and buckets load c…
Browse files Browse the repository at this point in the history
…orrectly. See #2288
  • Loading branch information
BluSunrize committed Jul 11, 2017
1 parent 0052327 commit fad86ce
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ public void serverStarted(FMLServerStartedEvent event)
IESaveData.setInstance(world.provider.getDimension(), worldData);
}
}
IEContent.refreshFluidReferences();
}

@Mod.EventHandler
public void remap(MissingMappings<?> ev) {
public void remap(MissingMappings<?> ev)
{
NameRemapper.remap(ev);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,10 +1132,20 @@ public void textureStichPre(TextureStitchEvent.Pre event)
ApiUtils.getRegisterSprite(event.getMap(), ConveyorSplit.texture_on);
ApiUtils.getRegisterSprite(event.getMap(), ConveyorSplit.texture_casing);

ApiUtils.getRegisterSprite(event.getMap(), IEContent.fluidPotion.getStill());
ApiUtils.getRegisterSprite(event.getMap(), IEContent.fluidPotion.getFlowing());
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:items/shader_slot");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/creosote_still");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/creosote_flow");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/plantoil_still");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/plantoil_flow");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/ethanol_still");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/ethanol_flow");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/biodiesel_still");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/biodiesel_flow");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/concrete_still");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/concrete_flow");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/potion_still");
ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:blocks/fluid/potion_flow");

ApiUtils.getRegisterSprite(event.getMap(), "immersiveengineering:items/shader_slot");
}
@SubscribeEvent
public void textureStichPost(TextureStitchEvent.Post event)
Expand Down
50 changes: 24 additions & 26 deletions src/main/java/blusunrize/immersiveengineering/common/IEContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,32 +190,12 @@ public class IEContent
public static VillagerRegistry.VillagerProfession villagerProfession_engineer;

static {

fluidCreosote = new Fluid("creosote", new ResourceLocation("immersiveengineering:blocks/fluid/creosote_still"), new ResourceLocation("immersiveengineering:blocks/fluid/creosote_flow")).setDensity(1100).setViscosity(3000);
if(!FluidRegistry.registerFluid(fluidCreosote))
fluidCreosote = FluidRegistry.getFluid("creosote");
FluidRegistry.addBucketForFluid(fluidCreosote);
fluidPlantoil = new Fluid("plantoil", new ResourceLocation("immersiveengineering:blocks/fluid/plantoil_still"), new ResourceLocation("immersiveengineering:blocks/fluid/plantoil_flow")).setDensity(925).setViscosity(2000);
if(!FluidRegistry.registerFluid(fluidPlantoil))
fluidPlantoil = FluidRegistry.getFluid("plantoil");
FluidRegistry.addBucketForFluid(fluidPlantoil);
fluidEthanol = new Fluid("ethanol", new ResourceLocation("immersiveengineering:blocks/fluid/ethanol_still"), new ResourceLocation("immersiveengineering:blocks/fluid/ethanol_flow")).setDensity(789).setViscosity(1000);
if(!FluidRegistry.registerFluid(fluidEthanol))
fluidEthanol = FluidRegistry.getFluid("ethanol");
FluidRegistry.addBucketForFluid(fluidEthanol);
fluidBiodiesel = new Fluid("biodiesel", new ResourceLocation("immersiveengineering:blocks/fluid/biodiesel_still"), new ResourceLocation("immersiveengineering:blocks/fluid/biodiesel_flow")).setDensity(789).setViscosity(1000);
if(!FluidRegistry.registerFluid(fluidBiodiesel))
fluidBiodiesel = FluidRegistry.getFluid("biodiesel");
FluidRegistry.addBucketForFluid(fluidBiodiesel);
fluidConcrete = new Fluid("concrete", new ResourceLocation("immersiveengineering:blocks/fluid/concrete_still"), new ResourceLocation("immersiveengineering:blocks/fluid/concrete_flow")).setDensity(2400).setViscosity(4000);
if(!FluidRegistry.registerFluid(fluidConcrete))
fluidConcrete = FluidRegistry.getFluid("concrete");
FluidRegistry.addBucketForFluid(fluidConcrete);

fluidPotion = new FluidPotion("potion", new ResourceLocation("immersiveengineering:blocks/fluid/potion_still"), new ResourceLocation("immersiveengineering:blocks/fluid/potion_flow"));
if(!FluidRegistry.registerFluid(fluidPotion))
fluidPotion = FluidRegistry.getFluid("potion");
FluidRegistry.addBucketForFluid(fluidPotion);
fluidCreosote = setupFluid(new Fluid("creosote", new ResourceLocation("immersiveengineering:blocks/fluid/creosote_still"), new ResourceLocation("immersiveengineering:blocks/fluid/creosote_flow")).setDensity(1100).setViscosity(3000));
fluidPlantoil = setupFluid(new Fluid("plantoil", new ResourceLocation("immersiveengineering:blocks/fluid/plantoil_still"), new ResourceLocation("immersiveengineering:blocks/fluid/plantoil_flow")).setDensity(925).setViscosity(2000));
fluidEthanol = setupFluid(new Fluid("ethanol", new ResourceLocation("immersiveengineering:blocks/fluid/ethanol_still"), new ResourceLocation("immersiveengineering:blocks/fluid/ethanol_flow")).setDensity(789).setViscosity(1000));
fluidBiodiesel = setupFluid(new Fluid("biodiesel", new ResourceLocation("immersiveengineering:blocks/fluid/biodiesel_still"), new ResourceLocation("immersiveengineering:blocks/fluid/biodiesel_flow")).setDensity(789).setViscosity(1000));
fluidConcrete = setupFluid(new Fluid("concrete", new ResourceLocation("immersiveengineering:blocks/fluid/concrete_still"), new ResourceLocation("immersiveengineering:blocks/fluid/concrete_flow")).setDensity(2400).setViscosity(4000));
fluidPotion = setupFluid(new FluidPotion("potion", new ResourceLocation("immersiveengineering:blocks/fluid/potion_still"), new ResourceLocation("immersiveengineering:blocks/fluid/potion_flow")));

blockOre = (BlockIEBase)new BlockIEBase("ore", Material.ROCK, PropertyEnum.create("type", BlockTypes_Ore.class), ItemBlockIEBase.class).setOpaque(true).setHardness(3.0F).setResistance(5.0F);
blockStorage = (BlockIEBase)new BlockIEBase("storage", Material.IRON, PropertyEnum.create("type", BlockTypes_MetalsIE.class), ItemBlockIEBase.class).setOpaque(true).setHardness(5.0F).setResistance(10.0F);
Expand Down Expand Up @@ -350,6 +330,14 @@ private static ResourceLocation createRegistryName(String unlocalized)
return new ResourceLocation(unlocalized);
}

private static Fluid setupFluid(Fluid fluid)
{
FluidRegistry.addBucketForFluid(fluid);
if(!FluidRegistry.registerFluid(fluid))
return FluidRegistry.getFluid(fluid.getName());
return fluid;
}

public static void preInit()
{
/**CONVEYORS*/
Expand Down Expand Up @@ -1034,6 +1022,16 @@ public static void postInit()
}
}

public static void refreshFluidReferences()
{
fluidCreosote = FluidRegistry.getFluid("creosote");
fluidPlantoil = FluidRegistry.getFluid("plantoil");
fluidEthanol = FluidRegistry.getFluid("ethanol");
fluidBiodiesel = FluidRegistry.getFluid("biodiesel");
fluidConcrete = FluidRegistry.getFluid("concrete");
fluidPotion = FluidRegistry.getFluid("potion");
}

public static void registerToOreDict(String type, ItemIEBase item, int... metas)
{
if(metas==null||metas.length<1)
Expand Down

0 comments on commit fad86ce

Please sign in to comment.