Skip to content

Commit

Permalink
Conduit models now render using dragonfly.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Mar 16, 2024
1 parent 7006e1b commit 91db77d
Show file tree
Hide file tree
Showing 81 changed files with 1,137 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.core.block.*;
import net.minecraft.core.block.material.Material;
import net.minecraft.core.block.tag.BlockTags;
import net.minecraft.core.data.tag.Tag;
import net.minecraft.core.entity.player.EntityPlayer;
import net.minecraft.core.item.Item;
import net.minecraft.core.item.ItemStack;
Expand Down Expand Up @@ -50,6 +51,7 @@
import sunsetsatellite.signalindustries.blocks.base.BlockTiered;
import sunsetsatellite.signalindustries.blocks.base.BlockUndroppable;
import sunsetsatellite.signalindustries.blocks.machines.*;
import sunsetsatellite.signalindustries.blocks.states.ConduitStateInterpreter;
import sunsetsatellite.signalindustries.blocks.states.EEPROMProgrammerStateInterpreter;
import sunsetsatellite.signalindustries.dim.WorldTypeEternity;
import sunsetsatellite.signalindustries.entities.EntityCrystal;
Expand Down Expand Up @@ -205,6 +207,10 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
//public static final Config config = new Config(MOD_ID, mapOf(new String[]{"PacketOpenMachineGUI_ID","PacketPipeItemSpawn_ID","GuiID"},new String[]{"113","114","9"}), new Class[]{SignalIndustries.class});

public static HashMap<String, ArrayList<Class<?>>> nameToGuiMap = new HashMap<>();

public static final Tag<Block> ENERGY_CONDUITS_CONNECT = Tag.of("energy_conduits_connect");
public static final Tag<Block> FLUID_CONDUITS_CONNECT = Tag.of("fluid_conduits_connect");

public static final Block signalumOre = new BlockBuilder(MOD_ID)
.setTextures("signalum_ore.png")
.setLuminance(3)
Expand Down Expand Up @@ -319,6 +325,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/energy/prototype/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"prototype_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockConduit("prototype.conduit",config.getInt("BlockIDs.prototypeConduit"),Tier.PROTOTYPE,Material.glass));

public static final Block basicConduit = new BlockBuilder(MOD_ID)
Expand All @@ -327,6 +341,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/energy/basic/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"basic_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockConduit("basic.conduit",config.getInt("BlockIDs.basicConduit"),Tier.BASIC,Material.glass));

public static final Block reinforcedConduit = new BlockBuilder(MOD_ID)
Expand All @@ -335,6 +357,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/energy/reinforced/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"reinforced_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockConduit("reinforced.conduit",config.getInt("BlockIDs.reinforcedConduit"),Tier.REINFORCED,Material.glass));

public static final Block awakenedConduit = new BlockBuilder(MOD_ID)
Expand All @@ -343,6 +373,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/energy/awakened/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"awakened_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockConduit("awakened.conduit",config.getInt("BlockIDs.awakenedConduit"),Tier.AWAKENED,Material.glass));


Expand All @@ -352,6 +390,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/fluid/prototype/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"prototype_fluid_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockFluidConduit("prototype.conduit.fluid",config.getInt("BlockIDs.prototypeFluidConduit"),Tier.PROTOTYPE,Material.glass));

public static final Block basicFluidConduit = new BlockBuilder(MOD_ID)
Expand All @@ -360,6 +406,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/fluid/basic/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"basic_fluid_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockFluidConduit("basic.conduit.fluid",config.getInt("BlockIDs.basicFluidConduit"),Tier.BASIC,Material.glass));

public static final Block reinforcedFluidConduit = new BlockBuilder(MOD_ID)
Expand All @@ -368,6 +422,14 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint {
.setResistance(1)
.setHardness(1)
.setBlockSound(BlockSounds.GLASS)
.setBlockModel(
new BlockModelDragonFly(
ModelHelper.getOrCreateBlockModel(MOD_ID,"conduit/fluid/reinforced/conduit_all.json"),
ModelHelper.getOrCreateBlockState(MOD_ID,"reinforced_fluid_conduit.json"),
new ConduitStateInterpreter(),
true
)
)
.build(new BlockFluidConduit("reinforced.conduit.fluid",config.getInt("BlockIDs.reinforcedFluidConduit"),Tier.REINFORCED,Material.glass));


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sunsetsatellite.signalindustries.blocks;


import net.minecraft.client.Minecraft;
import net.minecraft.core.block.entity.TileEntity;
import net.minecraft.core.block.material.Material;
import net.minecraft.core.entity.player.EntityPlayer;
Expand All @@ -21,11 +22,6 @@ protected TileEntity getNewBlockEntity() {
return new TileEntityConduit();
}

/*@Override
public int getRenderType() {
return 32;
}*/

public boolean isSolidRender() {
return false;
}
Expand All @@ -39,12 +35,12 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer ent
if(entityplayer.isSneaking() && !world.isClientSide){
TileEntityFluidPipe tile = (TileEntityFluidPipe) world.getBlockTileEntity(i,j,k);
if(tile.getFluidInSlot(0) != null && tile.getFluidInSlot(0).getLiquid() != null){
entityplayer.addChatMessage("Liquid: "+tile.getFluidInSlot(0).toString());
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Liquid: "+tile.getFluidInSlot(0).toString());
} else {
entityplayer.addChatMessage("Liquid: Empty");
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Liquid: Empty");
}
entityplayer.addChatMessage("Capacity: "+tile.fluidCapacity[0]);
entityplayer.addChatMessage("Is pressurized? "+tile.isPressurized);
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Capacity: "+tile.fluidCapacity[0]);
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Is pressurized? "+tile.isPressurized);
return false;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sunsetsatellite.signalindustries.blocks;


import net.minecraft.client.Minecraft;
import net.minecraft.core.block.entity.TileEntity;
import net.minecraft.core.block.material.Material;
import net.minecraft.core.entity.player.EntityPlayer;
Expand All @@ -21,11 +22,6 @@ protected TileEntity getNewBlockEntity() {
return new TileEntityFluidConduit();
}

/*@Override
public int getRenderType() {
return 32;
}*/

public boolean isSolidRender() {
return false;
}
Expand All @@ -39,12 +35,12 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer ent
if(entityplayer.isSneaking() && !world.isClientSide){
TileEntityFluidPipe tile = (TileEntityFluidPipe) world.getBlockTileEntity(i,j,k);
if(tile.getFluidInSlot(0) != null && tile.getFluidInSlot(0).getLiquid() != null){
entityplayer.addChatMessage("Liquid: "+tile.getFluidInSlot(0).toString());
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Liquid: "+tile.getFluidInSlot(0).toString());
} else {
entityplayer.addChatMessage("Liquid: Empty");
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Liquid: Empty");
}
entityplayer.addChatMessage("Capacity: "+tile.fluidCapacity[0]);
entityplayer.addChatMessage("Is pressurized? "+tile.isPressurized);
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Capacity: "+tile.fluidCapacity[0]);
Minecraft.getMinecraft(this).ingameGUI.addChatMessage("Is pressurized? "+tile.isPressurized);
return false;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import net.minecraft.core.world.WorldSource;
import sunsetsatellite.signalindustries.SignalIndustries;
import sunsetsatellite.signalindustries.blocks.base.BlockContainerTiered;
import sunsetsatellite.signalindustries.interfaces.IConduitsConnect;
import sunsetsatellite.signalindustries.inventories.TileEntityIgnitor;
import sunsetsatellite.signalindustries.util.Tier;

public class BlockIgnitor extends BlockContainerTiered implements IConduitsConnect {
public class BlockIgnitor extends BlockContainerTiered {

public BlockIgnitor(String key, int i, Tier tier, Material material) {
super(key, i, tier, material);
hasOverbright = true;
withTags(SignalIndustries.ENERGY_CONDUITS_CONNECT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package sunsetsatellite.signalindustries.blocks.states;

import net.minecraft.core.block.Block;
import net.minecraft.core.block.BlockTileEntity;
import net.minecraft.core.block.entity.TileEntity;
import net.minecraft.core.world.WorldSource;
import sunsetsatellite.catalyst.core.util.Direction;
import sunsetsatellite.catalyst.core.util.Vec3i;
import sunsetsatellite.catalyst.fluids.api.IFluidInventory;
import sunsetsatellite.signalindustries.SignalIndustries;
import sunsetsatellite.signalindustries.blocks.BlockConduit;
import sunsetsatellite.signalindustries.blocks.BlockFluidConduit;
import useless.dragonfly.model.blockstates.processed.MetaStateInterpreter;

import java.util.HashMap;

public class ConduitStateInterpreter extends MetaStateInterpreter {
@Override
public HashMap<String, String> getStateMap(WorldSource worldSource, int i, int j, int k, Block block, int meta) {
HashMap<String, String> states = new HashMap<>();
for (Direction direction : Direction.values()) {
boolean show = false;
Vec3i offset = new Vec3i(i,j,k).add(direction.getVec());
Block neighbouringBlock = worldSource.getBlock(offset.x, offset.y, offset.z);
if(neighbouringBlock != null) {
if(block.getClass().isAssignableFrom(neighbouringBlock.getClass())){
show = true;
} else if(!(neighbouringBlock instanceof BlockConduit || neighbouringBlock instanceof BlockFluidConduit)) {
if(neighbouringBlock instanceof BlockTileEntity){
TileEntity neighbouringTile = worldSource.getBlockTileEntity(offset.x, offset.y, offset.z);
if(neighbouringTile instanceof IFluidInventory){
show = true;
}
} else if (neighbouringBlock.hasTag(SignalIndustries.ENERGY_CONDUITS_CONNECT) || neighbouringBlock.hasTag(SignalIndustries.FLUID_CONDUITS_CONNECT)) {
show = true;
}
}
}
states.put(direction.getName().toLowerCase(), String.valueOf(show));
}
return states;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 91db77d

Please sign in to comment.