Skip to content

Commit

Permalink
bridge pillar update
Browse files Browse the repository at this point in the history
Bridge pillar has been moved to the new render/registry system.
pay attention mainly to the changes in BlockBridgePillar, TileBridgePillar, and TCBlocks.
CRTL-Shift-R is your friend for the lang files.
  • Loading branch information
EternalBlueFlame committed Jun 24, 2024
1 parent 27aa128 commit 07d2922
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 27 deletions.
3 changes: 0 additions & 3 deletions src/main/java/train/client/core/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ public void registerRenderInformation() {

ClientRegistry.bindTileEntitySpecialRenderer(TileTCRail.class, new RenderTCRail());

ClientRegistry.bindTileEntitySpecialRenderer(TileBridgePillar.class, new RenderBridgePillar());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockIDs.bridgePillar.block), new ItemRenderBridgePillar());

ClientRegistry.bindTileEntitySpecialRenderer(TileMetroMadridPole.class, new RenderMetroMadridPole());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockIDs.metroMadridPole.block), new ItemRenderModelMetroMadridPole());

Expand Down
1 change: 1 addition & 0 deletions src/main/java/train/common/blocks/BlockBridgePillar.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class BlockBridgePillar extends Block implements ITileEntityProvider {
public BlockBridgePillar() {
super(Material.wood);
setCreativeTab(Traincraft.tcTab);
setHarvestLevel("axe", 0);
//this.setTickRandomly(true);
//this.setBlockBounds(0.5F , 0.0F, 0.5F , 0.5F , 2.0F, 0.5F);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/train/common/blocks/BlockTCRail.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void onNeighborBlockChange(World world, int i, int j, int k, Block par5)
world.func_147480_a(i, j, k, false);
}
}
if (!World.doesBlockHaveSolidTopSurface(world, i, j - 1, k) && world.getBlock(i, j-1, k) != BlockIDs.bridgePillar.block) {
if (!World.doesBlockHaveSolidTopSurface(world, i, j - 1, k) && world.getBlock(i, j-1, k) != TCBlocks.bridgePillar) {
// NOTE: func_147480_a = destroyBlock
world.func_147480_a(i, j, k, false);
world.removeTileEntity(i, j, k);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/train/common/blocks/BlockTCRailGag.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void onNeighborBlockChange(World world, int i, int j, int k, Block par5)
world.func_147480_a(i, j, k, false);
world.removeTileEntity(i, j, k);
}
if (!World.doesBlockHaveSolidTopSurface(world, i, j - 1, k) && world.getBlock(i, j-1, k) != BlockIDs.bridgePillar.block) {
if (!World.doesBlockHaveSolidTopSurface(world, i, j - 1, k) && world.getBlock(i, j-1, k) != TCBlocks.bridgePillar) {
// NOTE: func_147480_a = destroyBlock
world.func_147480_a(i, j, k, false);
world.removeTileEntity(i, j, k);
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/train/common/blocks/TCBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import train.common.blocks.stairs.*;
import train.common.library.BlockIDs;
import train.common.library.Info;
import train.common.library.TraincraftRegistry;
import train.common.mtc.*;

public class TCBlocks {
Expand All @@ -28,7 +29,11 @@ public static void init() {
setHarvestLevels();
}

public static Block bridgePillar=new BlockBridgePillar().setHardness(3.5F).setStepSound(Block.soundTypeWood);

public static void loadBlocks() {
TraincraftRegistry.registerBlock(bridgePillar,Traincraft.tcTab, Info.modID,"bridgePillar");

BlockIDs.distilIdle.block = new BlockDistil(2, false).setHardness(3.5F).setStepSound(Block.soundTypeStone);
BlockIDs.distilActive.block = new BlockDistil(2, true).setHardness(3.5F).setStepSound(Block.soundTypeStone).setLightLevel(0.8F);
//BlockIDs.signal.block = new BlockSignal(BlockIDs.signal.block, 16).setHardness(1.7F).setStepSound(Block.soundTypeMetal);
Expand Down Expand Up @@ -87,8 +92,6 @@ public static void loadBlocks() {

BlockIDs.tcRail.block = new BlockTCRail().setHardness(1.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(null);
BlockIDs.tcRailGag.block = new BlockTCRailGag().setHardness(1.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(null);

BlockIDs.bridgePillar.block = new BlockBridgePillar().setHardness(3.5F).setStepSound(Block.soundTypeWood);

BlockIDs.MILWSwitchStand.block = new BlockMILWSwitchStand().setHardness(1F).setStepSound(Block.soundTypeStone);
BlockIDs.autoSwtichStand.block = new BlockautoSwitchStand().setHardness(1F).setStepSound(Block.soundTypeAnvil);
Expand Down Expand Up @@ -135,7 +138,6 @@ public static void setHarvestLevels() {
BlockIDs.assemblyTableIII.block.setHarvestLevel("axe", 0);
BlockIDs.waterWheel.block.setHarvestLevel("axe", 0);
BlockIDs.windMill.block.setHarvestLevel("axe", 0);
BlockIDs.bridgePillar.block.setHarvestLevel("axe", 0);
BlockIDs.oreTC.block.setHarvestLevel("pickaxe", 1);
BlockIDs.snowGravel.block.setHarvestLevel("shovel",0);
BlockIDs.poweredGravel.block.setHarvestLevel("shovel",0);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/train/common/core/handlers/RecipeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import train.common.blocks.TCBlocks;
import train.common.inventory.TrainCraftingManager;
import train.common.library.BlockIDs;
import train.common.library.ItemIDs;
Expand Down Expand Up @@ -266,7 +267,7 @@ public static void initBlockRecipes() {
GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltStairs.block, 4), " B", " BB", "BBB", 'B', new ItemStack(BlockIDs.asphalt.block));
GameRegistry.addRecipe(new ItemStack(BlockIDs.signalSpanish.block, 1), " L ", " I ", "RIR", 'L', new ItemStack(Blocks.redstone_lamp), 'I', new ItemStack(Items.iron_ingot), 'R', new ItemStack(Items.redstone));
GameRegistry.addRecipe(new ItemStack(BlockIDs.kSignal.block, 1), "RIR", " I ", " L ", 'L', new ItemStack(Blocks.redstone_lamp), 'I', new ItemStack(Items.iron_ingot), 'R', new ItemStack(Items.redstone));
GameRegistry.addRecipe(new ItemStack(BlockIDs.bridgePillar.block, 8), "SSS", "SLS", "SSS", 'S', new ItemStack(Items.stick), 'L', new ItemStack(Blocks.log));
GameRegistry.addRecipe(new ItemStack(TCBlocks.bridgePillar, 8), "SSS", "SLS", "SSS", 'S', new ItemStack(Items.stick), 'L', new ItemStack(Blocks.log));
GameRegistry.addRecipe(new ItemStack(BlockIDs.speedSign.block, 8), " R ", " I ", " I ", 'R', new ItemStack(Items.dye, 1, 1), 'I', new ItemStack(Items.iron_ingot));

//Gravel
Expand Down Expand Up @@ -632,7 +633,7 @@ public static void initItemRecipes() {
TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedFourWaysCrossing.item, 1), "DSD", "SDS", "DSD", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item);

// Bridge Pillar
TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.bridgePillar.block, 8),
TrainCraftingManager.instance.addRecipe(new ItemStack(TCBlocks.bridgePillar, 8),
"SSS", "SLS", "SSS", 'S', Items.stick, 'L', Blocks.log);
}

Expand Down
9 changes: 5 additions & 4 deletions src/main/java/train/common/items/ItemTCRail.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.World;
import org.lwjgl.util.vector.Matrix2f;
import org.lwjgl.util.vector.Vector2f;
import train.common.blocks.TCBlocks;
import train.common.library.BlockIDs;
import train.common.library.ItemIDs;
import train.common.tile.TileTCRail;
Expand Down Expand Up @@ -620,7 +621,7 @@ private boolean canPlaceTrack(EntityPlayer player, World world, int x, int y, in
return false;
}

return canBeReplaced(world, x, y, z) && (World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) || l1 == BlockIDs.bridgePillar.block);
return canBeReplaced(world, x, y, z) && (World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) || l1 == TCBlocks.bridgePillar);
}

private boolean canBeReplaced(World world, int x, int y, int z) {
Expand Down Expand Up @@ -727,7 +728,7 @@ private boolean putDownSlopedTurn(@Nullable EntityPlayer player, World world, in
int l, double r, double cx, double cy, double cz, float slopeAngle, double slopeLength, String type, Item idDrop) {


if (world.getBlock(x, y, z) == BlockIDs.bridgePillar.block) {
if (world.getBlock(x, y, z) == TCBlocks.bridgePillar) {
return false;
}

Expand Down Expand Up @@ -1003,7 +1004,7 @@ public boolean tryToPlaceTrack(ItemStack itemStack, EntityPlayer player, World w
y = getPlacementHeight(world, x, y, z);

ItemTCRail item = (ItemTCRail) itemStack.getItem();
if (world.getBlock(x, y, z) == BlockIDs.bridgePillar.block && item.getTrackType().getLabel().contains("DYNAMIC")) {
if (world.getBlock(x, y, z) == TCBlocks.bridgePillar && item.getTrackType().getLabel().contains("DYNAMIC")) {
return false;
}
int facing0 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
Expand Down Expand Up @@ -2548,7 +2549,7 @@ else if (type == TrackTypes.SLOPE_WOOD || type == TrackTypes.SLOPE_GRAVEL || typ
if (!canPlaceTrack(player, world, x, y + 1, z)) {
return false;
}
if (type.getLabel().contains("DYNAMIC") && world.getBlock(x, y, z) == BlockIDs.bridgePillar.block) {
if (type.getLabel().contains("DYNAMIC") && world.getBlock(x, y, z) == TCBlocks.bridgePillar) {
return false;
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/train/common/library/BlockIDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public enum BlockIDs {

tcRailGag(false,null),
tcRail(false,null),
bridgePillar(false,null),

MILWSwitchStand(false, null),
autoSwtichStand(false, null),
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/train/common/library/TraincraftRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ public static Block registerBlock(Block block, CreativeTabs tab, String MODID, S
}
}

public static Block registerBlock(Block block, CreativeTabs tab, String modid, String unlocalizedName) {
return registerBlock(block, tab, modid, unlocalizedName, null, Traincraft.proxy.getTESR());
}

public static Block registerBlock(Block block, CreativeTabs tab, String modid, String unlocalizedName, @Nullable String oreDictionaryName) {
return registerBlock(block, tab, modid, unlocalizedName, oreDictionaryName, Traincraft.proxy.getTESR());
}

public static Block registerBlock(Block block, CreativeTabs tab, String unlocalizedName, @Nullable String oreDictionaryName, @Nullable Object render) {
return registerBlock(block, tab, null, unlocalizedName, oreDictionaryName, render);
}
Expand Down
25 changes: 24 additions & 1 deletion src/main/java/train/common/tile/TileBridgePillar.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import train.common.api.blocks.TileRenderFacing;
import train.common.library.Info;

public class TileBridgePillar extends TileEntity {
public class TileBridgePillar extends TileRenderFacing {

@SideOnly(Side.CLIENT)
@Override
Expand All @@ -28,4 +33,22 @@ public boolean canUpdate()
{
return false;
}

@SideOnly(Side.CLIENT)
static final train.client.render.models.blocks.ModelBridgePillar modelBridgePillar = new train.client.render.models.blocks.ModelBridgePillar();
@SideOnly(Side.CLIENT)
static final ResourceLocation texture = new ResourceLocation(Info.modID, Info.modelTexPrefix + "bridgePillar.png");
@Override
public void func_145828_a(CrashReportCategory r){
if(r==null) {
fexcraft.tmt.slim.Tessellator.bindTexture(texture);
org.lwjgl.opengl.GL11.glTranslated(0.5, 0, 0.5);
org.lwjgl.opengl.GL11.glRotatef(180f, 180f, 1f, 0f);

modelBridgePillar.render();
} else {
super.func_145828_a(r);
}

}
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/cs_CZ.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Kolej Trainu
tile.tc:tcRailGag.name=Kolej Trainu
fluid.tc:fluid.diesel.name=Dieselové palivo
fluid.tc:fluid.refinedfuel.name=Rafinované palivo
tile.tc:bridgePillar.name=Mostní pilíř
tile.bridgePillar.name=Mostní pilíř
tile.tc:switchStand.name=Vysoká stojanová vyhýbka
tile.mtcspeedtransmitter.name=MTC Rychlostní vysílač
tile.mtcstatustransmitter.name=MTC Statový vysílač
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/da_DK.lang
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tile.tc:tcRail.name=Traincraft Skinne
tile.tc:tcRailGag.name=Traincraft Skinne
fluid.tc:fluid.diesel.name=Diesel Brændstof
fluid.tc:fluid.refinedfuel.name=Rafineret Brændstof
tile.tc:bridgePillar.name=Bropille
tile.bridgePillar.name=Bropille
tile.tc:switchStand.name=High Star Skiftehåndtag
tile.tc:mtcTransmitterSpeed.name=MTC Hastighedssender
tile.tc:mtcTransmitterMTC.name=MTC Statussender
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/de_DE.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Traincraft Gleis
tile.tc:tcRailGag.name=Traincraft Gleis
fluid.tc:fluid.diesel.name=Dieselkraftstoff
fluid.tc:fluid.refinedfuel.name=Rafinierter Kraftstoff
tile.tc:bridgePillar.name=Brückenpfeiler
tile.bridgePillar.name=Brückenpfeiler

<!-- ## Fluids ## -->
fluid.diesel.name=Dieselkraftstoff
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tile.tc:tcRail.name=Traincraft Rail
tile.tc:tcRailGag.name=Traincraft Rail
fluid.tc:fluid.diesel.name=Diesel Fuel
fluid.tc:fluid.refinedfuel.name=Refined Fuel
tile.tc:bridgePillar.name=Bridge Pillar
tile.bridgePillar.name=Bridge Pillar
tile.tc:switchStand.name=High Star Switch Stand
tile.tc:mtcTransmitterSpeed.name=MTC Speed Transmitter
tile.tc:mtcTransmitterMTC.name=MTC Status Transmitter
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/es_ES.lang
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tile.tc:tcRail.name=Vía
Traincraft tile.tc:tcRailGag.name=Vía Traincraft
fluid.tc:fluid.diesel.name=Gasoil
fluid.tc:fluid.refinedfuel.name=Fuel
tile.tc:bridgePillar.name=Pilar de puente
tile.bridgePillar.name=Pilar de puente
tile.tc:switchStand.name=Palanca de conmutador

<!-- ## Fluids ## -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/it_IT.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Binario di Traincraft
tile.tc:tcRailGag.name=Binario di Traincraft
fluid.tc:fluid.diesel.name=Carburante diesel
fluid.tc:fluid.refinedfuel.name=Carburante raffinato
tile.tc:bridgePillar.name=Pilone del ponte
tile.bridgePillar.name=Pilone del ponte
tile.tc:switchStand.name=Supporto del deviatore a stella

<!-- ## FLUIDS ## -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/nl_NL.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Traincraft Rails
tile.tc:tcRailGag.name=Traincraft Rails
fluid.tc:fluid.diesel.name=Diesel Brandstof
fluid.tc:fluid.refinedfuel.name=Gerafineerde Brandstof
tile.tc:bridgePillar.name=Brug Pilaar
tile.bridgePillar.name=Brug Pilaar
tile.tc:switchStand.name=Hoge Ster Switch Stand

<!-- ## Fluids ## -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/pl_PL.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Tor Traincraft
tile.tc:tcRailGag.name=Tor Traincraft
fluid.tc:fluid.diesel.name=Olej napędowy
fluid.tc:fluid.refinedfuel.name=Przetworzone paliwo
tile.tc:bridgePillar.name=Filar mostu
tile.bridgePillar.name=Filar mostu
tile.tc:switchStand.name=Podstawa przełącznika

<!-- ## Fluids ## -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/pt_BR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Trilho Traincraft
tile.tc:tcRailGag.name=Trilho Traincraft
fluid.tc:fluid.diesel.name=Óleo Diesel
fluid.tc:fluid.refinedfuel.name=Combustível Refinado
tile.tc:bridgePillar.name=Pilar de Ponte
tile.bridgePillar.name=Pilar de Ponte
tile.tc:switchStand.name=Chave High Star
tile.tc:mtcTransmitterSpeed.name=MTC Speed Transmitter
tile.tc:mtcTransmitterMTC.name=MTC Status Transmitter
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/si_SI.lang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tile.tc:tcRail.name=Traincraft tirnice
tile.tc:tcRailGag.name=Traincraft tirnice
fluid.tc:fluid.diesel.name=Dizelsko gorivo
fluid.tc:fluid.refinedfuel.name=Refinirano gorivo
tile.tc:bridgePillar.name=Podpornik mostu
tile.bridgePillar.name=Podpornik mostu

<!-- ## Fluids ## -->
fluid.diesel.name=Dizelsko gorivo
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tc/lang/sk_SK.lang
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tile.tc:tcRail.name=Koľaj (Traincraft)
tile.tc:tcRailGag.name=Koľaj (Traincraft)
fluid.tc:fluid.diesel.name=Nafta
fluid.tc:fluid.refinedfuel.name=Rafinovaná Nafta
tile.tc:bridgePillar.name=Drevený most
tile.bridgePillar.name=Drevený most
tile.tc:switchStand.name=Výhybka hviezdicového typu
tile.mtcspeedtransmitter.name=MTC Vysielač - Rýchlosť
tile.mtcstatustransmitter.name=MTC Vysielač - Pozícia
Expand Down

0 comments on commit 07d2922

Please sign in to comment.