Partially restore pump render (doesn't move yet)

This commit is contained in:
Vincent Lee committed 2019-11-19 11:40:00 -06:00
1 parent 5c9246ca8d
commit 53ea3b9bf3
9 files changed
+133 -61

No files matched your search

@@ -22,6 +22,7 @@ import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube;
import vazkii.botania.client.render.tile.RenderTilePump;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemKingKey;
import vazkii.botania.common.lib.LibMisc;
@@ -118,7 +119,8 @@ public class MiscellaneousIcons {
IBakedModel originalModelClip = evt.getModelRegistry().get(clipKey);
evt.getModelRegistry().put(key, new GunModel(evt.getModelLoader(), originalModel, originalModelClip));
RenderTileCorporeaCrystalCube.cubeModel = evt.getModelRegistry().get(new ResourceLocation(LibMisc.MOD_ID, "block/corporea_crystal_cube_glass"));
RenderTileCorporeaCrystalCube.cubeModel = evt.getModelRegistry().get(prefix("block/corporea_crystal_cube_glass"));
RenderTilePump.headModel = evt.getModelRegistry().get(prefix("block/mana_pump_head"));
}
@SubscribeEvent
@@ -84,7 +84,8 @@ public final class ModelHandler {
ModelLoader.addSpecialModel(new ModelResourceLocation(LibMisc.MOD_ID + ":mana_gun_clip", "inventory"));
ModelLoader.addSpecialModel(new ModelResourceLocation(LibMisc.MOD_ID + ":desu_gun", "inventory"));
ModelLoader.addSpecialModel(new ModelResourceLocation(LibMisc.MOD_ID + ":desu_gun_clip", "inventory"));
ModelLoader.addSpecialModel(new ResourceLocation(LibMisc.MOD_ID, "block/corporea_crystal_cube_glass"));
ModelLoader.addSpecialModel(prefix("block/corporea_crystal_cube_glass"));
ModelLoader.addSpecialModel(prefix("block/mana_pump_head"));
registerSubtiles();
RenderTileFloatingFlower renderTileFloatingFlower = new RenderTileFloatingFlower();
@@ -106,7 +107,7 @@ public final class ModelHandler {
ClientRegistry.bindTileEntitySpecialRenderer(TileRedString.class, new RenderTileRedString());
ClientRegistry.bindTileEntitySpecialRenderer(TilePrism.class, new RenderTilePrism());
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaIndex.class, new RenderTileCorporeaIndex());
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new TileEntityRendererAnimation<>());
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new RenderTilePump());
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube());
ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass());
@@ -0,0 +1,39 @@
package vazkii.botania.client.render.tile;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.util.Direction;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.mana.TilePump;
public class RenderTilePump extends TileEntityRenderer<TilePump> {
public static IBakedModel headModel = null;
@Override
public void render(TilePump pump, double x, double y, double z, float partialTicks, int destroyStage) {
GlStateManager.pushMatrix();
GlStateManager.translated(x, y, z);
GlStateManager.translated(0.5, 0, 0.5);
switch (pump.getBlockState().get(BotaniaStateProps.CARDINALS)) {
default:
case NORTH: break;
case SOUTH:
GlStateManager.rotatef(180, 0, 1, 0);
break;
case EAST:
GlStateManager.rotatef(-90, 0, 1, 0);
break;
case WEST:
GlStateManager.rotatef(90, 0, 1, 0);
break;
}
GlStateManager.translated(-0.5, 0, -0.5);
GlStateManager.color4f(1, 1, 1, 1);
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(headModel, 1, 1, 1, 1);
GlStateManager.popMatrix();
}
}
@@ -46,7 +46,7 @@ public class BlockPump extends BlockMod {
@Nullable
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return getDefaultState().with(BotaniaStateProps.CARDINALS, context.getNearestLookingDirection().getOpposite());
return getDefaultState().with(BotaniaStateProps.CARDINALS, context.getPlacementHorizontalFacing().getOpposite());
}
@Nonnull
@@ -48,27 +48,8 @@ public class TilePump extends TileMod implements ITickableTileEntity {
public boolean hasRedstone = false;
private int lastComparator = 0;
private final TimeValues.VariableValue move;
private final IAnimationStateMachine asm;
private final LazyOptional<IAnimationStateMachine> asmCap;
public TilePump() {
super(TYPE);
if (FMLEnvironment.dist == Dist.CLIENT) {
move = new TimeValues.VariableValue(0);
asm = ModelLoaderRegistry.loadASM(new ResourceLocation("botania", "asms/block/pump.json"), ImmutableMap.of("move", move));
asmCap = LazyOptional.of(() -> asm);
} else {
move = null;
asm = null;
asmCap = LazyOptional.empty();
}
}
@Nonnull
@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
return CapabilityAnimation.ANIMATION_CAPABILITY.orEmpty(cap, asmCap);
}
@Override
@@ -105,9 +86,6 @@ public class TilePump extends TileMod implements ITickableTileEntity {
}
}
if(world.isRemote)
move.setValue(innerRingPos / 8 * 0.5F); // rescale to 0 - 0.5 for json animation
if(!hasCartOnTop)
comparator = 0;
if(!hasCart && active)
@@ -130,11 +108,7 @@ public class TilePump extends TileMod implements ITickableTileEntity {
@Override
public void readPacketNBT(CompoundNBT cmp) {
boolean prevActive = active;
active = cmp.getBoolean(TAG_ACTIVE);
if(world != null && world.isRemote)
if(prevActive != active)
asm.transition(active ? "moving" : "default");
}
public void setActive(boolean active) {
@@ -1,33 +1,8 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"particle": "botania:blocks/livingrock0"
},
"transform": "forge:default-block"
},
"variants": {
"facing": {
"north": {},
"south": { "y": 180 },
"west": { "y": 270 },
"east": { "y": 90 }
},
"static": {
"true": {
"model": "botania:block/mana_pump"
},
"false": {
"model": "botania:block/mana_pump_head"
}
},
"inventory": [{
"model": "botania:block/mana_pump",
"submodel": {
"head": {
"model": "botania:block/mana_pump_head"
}
}
}]
"facing=north": { "model": "botania:block/mana_pump" },
"facing=south": { "model": "botania:block/mana_pump","y": 180 },
"facing=west": { "model": "botania:block/mana_pump","y": 270 },
"facing=east": { "model": "botania:block/mana_pump","y": 90 }
}
}
@@ -1,8 +1,10 @@
{
"Comment": "Designed by Wiiv with Cubik Studio - https://cubik.studio",
"parent": "minecraft:block/block",
"textures": {
"structure": "botania:blocks/pump_structure",
"head_sheat": "botania:blocks/pump_head_sheat"
"head_sheat": "botania:blocks/pump_head_sheat",
"particle": "botania:blocks/livingrock0"
},
"elements": [
{
@@ -1,7 +1,9 @@
{
"Comment": "Designed by Wiiv with Cubik Studio - https://cubik.studio",
"parent": "minecraft:block/block",
"textures": {
"head_sheat": "botania:blocks/pump_head_sheat"
"head_sheat": "botania:blocks/pump_head_sheat",
"particle": "botania:blocks/livingrock0"
},
"elements": [
{
@@ -0,0 +1,77 @@
{
"Comment0": "Combination of block/mana_pump and block/mana_pump_head",
"Comment": "Designed by Wiiv with Cubik Studio - https://cubik.studio",
"parent": "minecraft:block/block",
"textures": {
"structure": "botania:blocks/pump_structure",
"head_sheat": "botania:blocks/pump_head_sheat",
"particle": "botania:blocks/livingrock0"
},
"elements": [
{
"Comment": "end_east",
"from": [ 4, 0, 14 ],
"to": [ 12, 8, 16 ],
"faces": {
"down": { "uv": [ 8, 2, 16, 4 ], "texture": "#structure" },
"up": { "uv": [ 8, 2, 16, 4 ], "texture": "#structure" },
"north": { "uv": [ 0, 8, 8, 16 ], "texture": "#structure" },
"south": { "uv": [ 0, 0, 8, 8 ], "texture": "#structure" },
"west": { "uv": [ 8, 2, 16, 0 ], "texture": "#structure", "rotation": 90 },
"east": { "uv": [ 8, 0, 16, 2 ], "texture": "#structure", "rotation": 90 }
}
},
{
"Comment": "end_west",
"from": [ 4, 0, 0 ],
"to": [ 12, 8, 2 ],
"faces": {
"down": { "uv": [ 8, 2, 16, 4 ], "texture": "#structure" },
"up": { "uv": [ 8, 2, 16, 4 ], "texture": "#structure" },
"north": { "uv": [ 0, 0, 8, 8 ], "texture": "#structure" },
"south": { "uv": [ 0, 8, 8, 16 ], "texture": "#structure" },
"west": { "uv": [ 8, 4, 16, 2 ], "texture": "#structure", "rotation": 90 },
"east": { "uv": [ 8, 2, 16, 4 ], "texture": "#structure", "rotation": 90 }
}
},
{
"Comment": "tube",
"from": [ 6, 2, 2 ],
"to": [ 10, 6, 10 ],
"faces": {
"down": { "uv": [ 12, 8, 16, 16 ], "texture": "#structure" },
"up": { "uv": [ 12, 8, 16, 16 ], "texture": "#structure" },
"north": { "uv": [ 8, 12, 12, 16 ], "texture": "#structure" },
"south": { "uv": [ 8, 8, 12, 12 ], "texture": "#structure" },
"west": { "uv": [ 8, 4, 16, 8 ], "texture": "#structure" },
"east": { "uv": [ 8, 4, 16, 8 ], "texture": "#structure" }
}
},
{
"Comment": "sheat",
"from": [ 4, 0, 10 ],
"to": [ 12, 8, 14 ],
"faces": {
"down": { "uv": [ 8, 4, 16, 8 ], "texture": "#head_sheat" },
"up": { "uv": [ 8, 0, 16, 4 ], "texture": "#head_sheat" },
"north": { "uv": [ 0, 0, 8, 8 ], "texture": "#head_sheat" },
"south": { "uv": [ 0, 0, 8, 8 ], "texture": "#head_sheat" },
"west": { "uv": [ 8, 8, 16, 4 ], "texture": "#head_sheat", "rotation": 90 },
"east": { "uv": [ 8, 4, 16, 8 ], "texture": "#head_sheat", "rotation": 90 }
}
},
{
"Comment": "head",
"from": [ 5, 1, 2 ],
"to": [ 11, 7, 6 ],
"faces": {
"down": { "uv": [ 6, 8, 12, 12 ], "texture": "#head_sheat" },
"up": { "uv": [ 6, 8, 12, 12 ], "texture": "#head_sheat" },
"north": { "uv": [ 0, 8, 6, 14 ], "texture": "#head_sheat" },
"south": { "uv": [ 0, 8, 6, 14 ], "texture": "#head_sheat" },
"west": { "uv": [ 6, 12, 12, 8 ], "texture": "#head_sheat", "rotation": 90 },
"east": { "uv": [ 6, 8, 12, 12 ], "texture": "#head_sheat", "rotation": 90 }
}
}
]
}