Refactored animated block partials

- Moved all block partials used only for rendering out of the registry
- Refactored model registry hooks and custom block model handling
- Added a safety layer for all tile entity renderers, addresses #76
- Overstressed indicator no longer shows when the kinetic source changes
- Fixed framed glass rendering glass textures inbetween blocks
- Fixed blockzapper adding itself twice to the item group
- Fixed basing not spawning particles properly
- Updated Forge
- Reworked Schematicannon model
This commit is contained in:
simibubi 2020-02-04 14:48:21 +01:00
parent b5b1a995d7
commit aacc52d84a
99 changed files with 1084 additions and 1140 deletions

View file

@ -71,7 +71,7 @@ repositories {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.14.4-28.1.115'
minecraft 'net.minecraftforge:forge:1.14.4-28.2.0'
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.26:api")

View file

@ -0,0 +1,113 @@
package com.simibubi.create;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
import java.util.Map;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
public enum AllBlockPartials {
SCHEMATICANNON_CONNECTOR("schematicannon/connector"),
SCHEMATICANNON_PIPE("schematicannon/pipe"),
SHAFTLESS_COGWHEEL("cogwheel_shaftless"),
BELT_PULLEY,
SHAFT_HALF,
ENCASED_FAN_INNER("encased_fan/propeller"),
HAND_CRANK_HANDLE("hand_crank/handle"),
MECHANICAL_PRESS_HEAD,
MECHANICAL_MIXER_POLE("mixer_pole"),
MECHANICAL_MIXER_HEAD("mixer_head"),
MECHANICAL_CRAFTER_LID("crafter/lid"),
MECHANICAL_CRAFTER_ARROW("crafter/arrow"),
MECHANICAL_CRAFTER_BELT_FRAME("crafter/belt"),
MECHANICAL_CRAFTER_BELT("crafter/belt_animated"),
GAUGE_DIAL("gauge/dial"),
GAUGE_INDICATOR("gauge/indicator"),
GAUGE_HEAD_SPEED("gauge/speed"),
GAUGE_HEAD_STRESS("gauge/stress"),
MECHANICAL_BEARING_TOP,
DRILL,
HARVESTER_BLADE,
DEPLOYER_POLE("deployer/pole"),
DEPLOYER_HAND_POINTING("deployer/hand_pointing"),
DEPLOYER_HAND_PUNCHING("deployer/hand_punching"),
DEPLOYER_HAND_HOLDING("deployer/hand_holding"),
ANALOG_LEVER_HANDLE("analog_lever/handle"),
ANALOG_LEVER_INDICATOR("analog_lever/indicator"),
BELT_TUNNEL_FLAP("belt_tunnel/flap"),
BELT_TUNNEL_INDICATOR("belt_tunnel/indicator"),
FLEXPEATER_INDICATOR("repeaters/flexpeater_indicator"),
;
private ResourceLocation modelLocation;
private IBakedModel bakedModel;
private AllBlockPartials() {
}
private AllBlockPartials(String path) {
modelLocation = new ResourceLocation(Create.ID, "block/" + path);
}
public static void onModelRegistry(ModelRegistryEvent event) {
for (AllBlockPartials partial : AllBlockPartials.values()) {
partial.createModelLocation();
ModelLoader.addSpecialModel(partial.modelLocation);
}
}
public static void onModelBake(ModelBakeEvent event) {
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
for (AllBlockPartials partial : AllBlockPartials.values()) {
partial.createModelLocation();
partial.bakedModel = modelRegistry.get(partial.modelLocation);
}
}
private void createModelLocation() {
if (modelLocation == null)
modelLocation = new ResourceLocation(Create.ID, "block/" + Lang.asId(name()));
}
public IBakedModel get() {
return bakedModel;
}
public SuperByteBuffer renderOn(BlockState referenceState) {
return CreateClient.bufferCache.renderPartial(this, referenceState);
}
public SuperByteBuffer renderOnDirectional(BlockState referenceState) {
Direction facing = referenceState.get(FACING);
return renderOnDirectional(referenceState, facing);
}
public SuperByteBuffer renderOnHorizontal(BlockState referenceState) {
Direction facing = referenceState.get(HORIZONTAL_FACING);
return renderOnDirectional(referenceState, facing);
}
public SuperByteBuffer renderOnDirectional(BlockState referenceState, Direction facing) {
SuperByteBuffer renderPartial = CreateClient.bufferCache.renderPartial(this, referenceState);
renderPartial.rotateCentered(Axis.X, AngleHelper.rad(AngleHelper.verticalAngle(facing)));
renderPartial.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(facing)));
return renderPartial;
}
}

View file

@ -4,17 +4,12 @@ import com.simibubi.create.foundation.block.IHaveColorHandler;
import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ProperStairsBlock;
import com.simibubi.create.foundation.block.RenderUtilityAxisBlock;
import com.simibubi.create.foundation.block.RenderUtilityBlock;
import com.simibubi.create.foundation.block.RenderUtilityDirectionalBlock;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.world.OxidizingBlock;
import com.simibubi.create.modules.IModule;
import com.simibubi.create.modules.contraptions.CasingBlock;
import com.simibubi.create.modules.contraptions.components.actors.DrillBlock;
import com.simibubi.create.modules.contraptions.components.actors.DrillBlock.DrillHeadBlock;
import com.simibubi.create.modules.contraptions.components.actors.HarvesterBlock;
import com.simibubi.create.modules.contraptions.components.actors.HarvesterBlock.HarvesterBladeBlock;
import com.simibubi.create.modules.contraptions.components.contraptions.bearing.MechanicalBearingBlock;
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.LinearChassisBlock;
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.RadialChassisBlock;
@ -43,7 +38,6 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftHalfBlock;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
@ -69,6 +63,7 @@ import com.simibubi.create.modules.logistics.block.transposer.LinkedTransposerBl
import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock;
import com.simibubi.create.modules.palettes.CTGlassBlock;
import com.simibubi.create.modules.palettes.CTGlassPaneBlock;
import com.simibubi.create.modules.palettes.CTWindowBlock;
import com.simibubi.create.modules.palettes.GlassPaneBlock;
import com.simibubi.create.modules.palettes.HorizontalCTGlassBlock;
import com.simibubi.create.modules.palettes.LayeredCTBlock;
@ -103,8 +98,6 @@ public enum AllBlocks {
__SCHEMATICS__(),
SCHEMATICANNON(new SchematicannonBlock()),
SCHEMATICANNON_CONNECTOR(new RenderUtilityBlock()),
SCHEMATICANNON_PIPE(new RenderUtilityBlock()),
CREATIVE_CRATE(new CreativeCrateBlock()),
SCHEMATIC_TABLE(new SchematicTableBlock()),
@ -112,7 +105,6 @@ public enum AllBlocks {
SHAFT(new ShaftBlock(Properties.from(Blocks.ANDESITE))),
COGWHEEL(new CogWheelBlock(false)),
LARGE_COGWHEEL(new CogWheelBlock(true)),
SHAFTLESS_COGWHEEL(new RenderUtilityAxisBlock()),
ENCASED_SHAFT(new EncasedShaftBlock()),
GEARBOX(new GearboxBlock()),
CLUTCH(new ClutchBlock()),
@ -120,60 +112,37 @@ public enum AllBlocks {
ENCASED_BELT(new EncasedBeltBlock()),
ADJUSTABLE_PULLEY(new AdjustablePulleyBlock()),
BELT(new BeltBlock()),
BELT_PULLEY(new RenderUtilityAxisBlock()),
MOTOR(new MotorBlock()),
WATER_WHEEL(new WaterWheelBlock()),
ENCASED_FAN(new EncasedFanBlock()),
ENCASED_FAN_INNER(new RenderUtilityDirectionalBlock()),
NOZZLE(new NozzleBlock()),
TURNTABLE(new TurntableBlock()),
SHAFT_HALF(new ShaftHalfBlock()),
HAND_CRANK(new HandCrankBlock()),
HAND_CRANK_HANDLE(new RenderUtilityDirectionalBlock()),
CRUSHING_WHEEL(new CrushingWheelBlock()),
CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()),
MECHANICAL_PRESS(new MechanicalPressBlock()),
MECHANICAL_PRESS_HEAD(new MechanicalPressBlock.Head()),
MECHANICAL_MIXER(new MechanicalMixerBlock()),
MECHANICAL_MIXER_POLE(new RenderUtilityBlock()),
MECHANICAL_MIXER_HEAD(new RenderUtilityBlock()),
BASIN(new BasinBlock()),
MECHANICAL_CRAFTER(new MechanicalCrafterBlock()),
MECHANICAL_CRAFTER_LID(new RenderUtilityBlock()),
MECHANICAL_CRAFTER_ARROW(new RenderUtilityBlock()),
MECHANICAL_CRAFTER_BELT_FRAME(new RenderUtilityBlock()),
MECHANICAL_CRAFTER_BELT(new RenderUtilityBlock()),
SPEED_GAUGE(new GaugeBlock(GaugeBlock.Type.SPEED)),
STRESS_GAUGE(new GaugeBlock(GaugeBlock.Type.STRESS)),
GAUGE_DIAL(new RenderUtilityBlock()),
GAUGE_INDICATOR(new RenderUtilityBlock()),
GAUGE_HEAD(new GaugeBlock.Head()),
MECHANICAL_PISTON(new MechanicalPistonBlock(false)),
STICKY_MECHANICAL_PISTON(new MechanicalPistonBlock(true)),
MECHANICAL_PISTON_HEAD(new MechanicalPistonHeadBlock()),
PISTON_POLE(new PistonPoleBlock()),
MECHANICAL_BEARING(new MechanicalBearingBlock()),
MECHANICAL_BEARING_TOP(new ShaftHalfBlock()),
TRANSLATION_CHASSIS(new LinearChassisBlock()),
TRANSLATION_CHASSIS_SECONDARY(new LinearChassisBlock()),
ROTATION_CHASSIS(new RadialChassisBlock()),
DRILL(new DrillBlock()),
DRILL_HEAD(new DrillHeadBlock()),
SAW(new SawBlock()),
HARVESTER(new HarvesterBlock()),
HARVESTER_BLADE(new HarvesterBladeBlock()),
DEPLOYER(new DeployerBlock()),
DEPLOYER_POLE(new RenderUtilityBlock()),
DEPLOYER_HAND_POINTING(new RenderUtilityBlock()),
DEPLOYER_HAND_PUNCHING(new RenderUtilityBlock()),
DEPLOYER_HAND_HOLDING(new RenderUtilityBlock()),
CART_ASSEMBLER(new CartAssemblerBlock()),
MINECART_ANCHOR(new MinecartAnchorBlock()),
ANALOG_LEVER(new AnalogLeverBlock()),
ANALOG_LEVER_HANDLE(new RenderUtilityBlock()),
ANALOG_LEVER_INDICATOR(new RenderUtilityBlock()),
ANDESITE_CASING(new CasingBlock("andesite_casing")),
COPPER_CASING(new CasingBlock("copper_casing")),
@ -195,13 +164,10 @@ public enum AllBlocks {
BELT_FUNNEL(new FunnelBlock()),
VERTICAL_FUNNEL(new FunnelBlock.Vertical()),
BELT_TUNNEL(new BeltTunnelBlock()),
BELT_TUNNEL_FLAP(new RenderUtilityBlock()),
BELT_TUNNEL_INDICATOR(new RenderUtilityBlock()),
ENTITY_DETECTOR(new BeltObserverBlock()),
PULSE_REPEATER(new PulseRepeaterBlock()),
FLEXPEATER(new FlexpeaterBlock()),
FLEXPULSEPEATER(new FlexpeaterBlock()),
FLEXPEATER_INDICATOR(new RenderUtilityBlock()),
__CURIOSITIES__(),
SYMMETRY_PLANE(new PlaneSymmetryBlock()),
@ -216,13 +182,13 @@ public enum AllBlocks {
HORIZONTAL_FRAMED_GLASS(new HorizontalCTGlassBlock(AllCTs.HORIZONTAL_FRAMED_GLASS, AllCTs.FRAMED_GLASS, false)),
VERTICAL_FRAMED_GLASS(new VerticalCTGlassBlock(AllCTs.VERTICAL_FRAMED_GLASS, false)),
OAK_GLASS(new VerticalCTGlassBlock(AllCTs.OAK_GLASS, false)),
SPRUCE_GLASS(new VerticalCTGlassBlock(AllCTs.SPRUCE_GLASS, false)),
BIRCH_GLASS(new VerticalCTGlassBlock(AllCTs.BIRCH_GLASS, true)),
JUNGLE_GLASS(new VerticalCTGlassBlock(AllCTs.JUNGLE_GLASS, false)),
DARK_OAK_GLASS(new VerticalCTGlassBlock(AllCTs.DARK_OAK_GLASS, false)),
ACACIA_GLASS(new VerticalCTGlassBlock(AllCTs.ACACIA_GLASS, false)),
IRON_GLASS(new VerticalCTGlassBlock(AllCTs.IRON_GLASS, false)),
OAK_GLASS(new CTWindowBlock(AllCTs.OAK_GLASS, false)),
SPRUCE_GLASS(new CTWindowBlock(AllCTs.SPRUCE_GLASS, false)),
BIRCH_GLASS(new CTWindowBlock(AllCTs.BIRCH_GLASS, true)),
JUNGLE_GLASS(new CTWindowBlock(AllCTs.JUNGLE_GLASS, false)),
DARK_OAK_GLASS(new CTWindowBlock(AllCTs.DARK_OAK_GLASS, false)),
ACACIA_GLASS(new CTWindowBlock(AllCTs.ACACIA_GLASS, false)),
IRON_GLASS(new CTWindowBlock(AllCTs.IRON_GLASS, false)),
TILED_GLASS_PANE(new GlassPaneBlock(Properties.from(Blocks.GLASS))),
FRAMED_GLASS_PANE(new CTGlassPaneBlock(FRAMED_GLASS.block)),

View file

@ -5,17 +5,13 @@ import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.simibubi.create.foundation.block.IHaveColoredVertices;
import com.simibubi.create.foundation.block.connected.CTModel;
import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures;
import com.simibubi.create.foundation.block.render.ColoredVertexModel;
import com.simibubi.create.foundation.block.render.CustomRenderedItemModel;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import com.simibubi.create.foundation.item.IHaveCustomItemModel;
import com.simibubi.create.foundation.utility.SuperByteBufferCache;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionRenderer;
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockModel;
import com.simibubi.create.modules.schematics.ClientSchematicLoader;
import com.simibubi.create.modules.schematics.client.SchematicAndQuillHandler;
import com.simibubi.create.modules.schematics.client.SchematicHandler;
@ -28,7 +24,6 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -107,63 +102,41 @@ public class CreateClient {
event.addSprite(new ResourceLocation(Create.ID, "block/belt_animated"));
for (AllBlocks allBlocks : AllBlocks.values()) {
Block block = allBlocks.get();
if (!(block instanceof IHaveConnectedTextures))
continue;
for (SpriteShiftEntry spriteShiftEntry : ((IHaveConnectedTextures) block).getBehaviour().getAllCTShifts())
event.addSprite(spriteShiftEntry.getTargetResourceLocation());
if (block instanceof IHaveConnectedTextures)
for (SpriteShiftEntry spriteShiftEntry : ((IHaveConnectedTextures) block).getBehaviour()
.getAllCTShifts())
event.addSprite(spriteShiftEntry.getTargetResourceLocation());
}
}
@OnlyIn(Dist.CLIENT)
public static void onModelBake(ModelBakeEvent event) {
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
AllBlockPartials.onModelBake(event);
// Swap Models for CT Blocks and Blocks with colored Vertices
for (AllBlocks allBlocks : AllBlocks.values()) {
Block block = allBlocks.get();
if (block == null)
continue;
List<ModelResourceLocation> blockModelLocations = getAllBlockStateModelLocations(allBlocks);
if (block instanceof IHaveConnectedTextures)
swapModels(modelRegistry, blockModelLocations, t -> new CTModel(t, (IHaveConnectedTextures) block));
if (block instanceof IHaveColoredVertices)
swapModels(modelRegistry, blockModelLocations,
t -> new ColoredVertexModel(t, (IHaveColoredVertices) block));
if (block instanceof IHaveCustomBlockModel)
swapModels(modelRegistry, getAllBlockStateModelLocations(allBlocks),
((IHaveCustomBlockModel) block)::createModel);
}
// Swap Models for custom rendered item models
for (AllItems item : AllItems.values()) {
if (!(item.get() instanceof IHaveCustomItemModel))
continue;
IHaveCustomItemModel specialItem = (IHaveCustomItemModel) item.get();
ModelResourceLocation location = new ModelResourceLocation(item.get().getRegistryName(), "inventory");
CustomRenderedItemModel model = specialItem.createModel(modelRegistry.get(location));
model.loadPartials(event);
modelRegistry.put(location, model);
if (item.get() instanceof IHaveCustomItemModel)
swapModels(modelRegistry, getItemModelLocation(item),
m -> ((IHaveCustomItemModel) item.get()).createModel(m).loadPartials(event));
}
swapModels(modelRegistry, getAllBlockStateModelLocations(AllBlocks.WINDOW_IN_A_BLOCK),
WindowInABlockModel::new);
swapModels(modelRegistry,
getBlockModelLocation(AllBlocks.WINDOW_IN_A_BLOCK,
BlockModelShapes.getPropertyMapString(AllBlocks.WINDOW_IN_A_BLOCK.get().getDefaultState()
.with(BlockStateProperties.WATERLOGGED, true).getValues())),
WindowInABlockModel::new);
}
@OnlyIn(Dist.CLIENT)
public static void onModelRegistry(ModelRegistryEvent event) {
AllBlockPartials.onModelRegistry(event);
// Register submodels for custom rendered item models
for (AllItems item : AllItems.values()) {
if (!(item.get() instanceof IHaveCustomItemModel))
continue;
IHaveCustomItemModel specialItem = (IHaveCustomItemModel) item.get();
CustomRenderedItemModel model = specialItem.createModel(null);
model.getModelLocations().forEach(ModelLoader::addSpecialModel);
if (item.get() instanceof IHaveCustomItemModel)
((IHaveCustomItemModel) item.get()).createModel(null).getModelLocations()
.forEach(ModelLoader::addSpecialModel);
}
}

View file

@ -61,7 +61,7 @@ public final class CreateItemGroup extends ItemGroup {
if (!item.module.isEnabled())
continue;
IBakedModel model = itemRenderer.getModelWithOverrides(item.asStack());
if ((model.isBuiltInRenderer() || model.isGui3d()) != specialItems)
if (model.isGui3d() != specialItems)
continue;
if (item.get() instanceof IAddedByOther)
continue;

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.compat.jei.EmptyBackground;
@ -16,6 +17,7 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
@ -66,14 +68,19 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> implements
GlStateManager.rotated(15.5, 0, 1, 0);
GlStateManager.scaled(.6f, .6f, .6f);
ScreenElementRenderer.renderBlock(this::renderFanCasing);
GlStateManager.pushMatrix();
float angle = AnimatedKinetics.getCurrentAngle() * 12;
float t = 25;
GlStateManager.translatef(t, -t, t);
GlStateManager.rotated(angle, 0, 0, 1);
GlStateManager.translatef(-t, t, -t);
ScreenElementRenderer.renderBlock(this::renderFanInner);
GlStateManager.translatef(t, 0, 175);
GlStateManager.rotated(90, 0, 1, 0);
GlStateManager.translatef(-t, 0, -175);
ScreenElementRenderer.renderModel(this::renderFanInner);
GlStateManager.popMatrix();
GlStateManager.translated(-10, 0, 95);
@ -88,8 +95,8 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> implements
return AllBlocks.ENCASED_FAN.get().getDefaultState().with(BlockStateProperties.FACING, Direction.WEST);
}
protected BlockState renderFanInner() {
return AllBlocks.ENCASED_FAN_INNER.get().getDefaultState().with(BlockStateProperties.FACING, Direction.WEST);
protected IBakedModel renderFanInner() {
return AllBlockPartials.ENCASED_FAN_INNER.get();
}
public abstract void renderAttachedBlock();

View file

@ -1,14 +1,14 @@
package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterBlock;
import net.minecraft.block.BlockState;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
public class AnimatedCrafter extends AnimatedKinetics {
@ -38,35 +38,36 @@ public class AnimatedCrafter extends AnimatedKinetics {
GlStateManager.translatef(-45, -5, 0);
GlStateManager.scaled(.45f, .45f, .45f);
ScreenElementRenderer.renderBlock(() -> cogwheel(true));
ScreenElementRenderer.renderModel(() -> cogwheel(true));
ScreenElementRenderer.renderBlock(this::body);
GlStateManager.translatef(0, 50, 0);
ScreenElementRenderer.renderBlock(() -> cogwheel(false));
ScreenElementRenderer.renderModel(() -> cogwheel(false));
ScreenElementRenderer.renderBlock(this::body);
if (four) {
GlStateManager.translatef(50, -50, 0);
ScreenElementRenderer.renderBlock(() -> cogwheel(false));
ScreenElementRenderer.renderModel(() -> cogwheel(false));
ScreenElementRenderer.renderBlock(this::body);
GlStateManager.translatef(0, 50, 0);
ScreenElementRenderer.renderBlock(() -> cogwheel(true));
ScreenElementRenderer.renderModel(() -> cogwheel(true));
ScreenElementRenderer.renderBlock(this::body);
} else {
GlStateManager.translatef(0, 50, 0);
ScreenElementRenderer.renderBlock(() -> cogwheel(true));
ScreenElementRenderer.renderModel(() -> cogwheel(true));
ScreenElementRenderer.renderBlock(this::body);
}
GlStateManager.popMatrix();
}
private BlockState cogwheel(boolean forward) {
private IBakedModel cogwheel(boolean forward) {
float t = 25;
GlStateManager.translatef(t, -t, -t);
GlStateManager.rotated(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1);
GlStateManager.rotated(90, 1, 0, 0);
GlStateManager.translatef(-t, t, t);
return AllBlocks.SHAFTLESS_COGWHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
}
private BlockState body() {

View file

@ -1,12 +1,12 @@
package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis;
import net.minecraft.client.renderer.model.IBakedModel;
public class AnimatedMixer extends AnimatedKinetics {
@ -31,7 +31,7 @@ public class AnimatedMixer extends AnimatedKinetics {
GlStateManager.scaled(.45f, .45f, .45f);
GlStateManager.pushMatrix();
ScreenElementRenderer.renderBlock(this::cogwheel);
ScreenElementRenderer.renderModel(this::cogwheel);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
@ -39,11 +39,11 @@ public class AnimatedMixer extends AnimatedKinetics {
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
ScreenElementRenderer.renderBlock(this::pole);
ScreenElementRenderer.renderModel(this::pole);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
ScreenElementRenderer.renderBlock(this::head);
ScreenElementRenderer.renderModel(this::head);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
@ -53,30 +53,30 @@ public class AnimatedMixer extends AnimatedKinetics {
GlStateManager.popMatrix();
}
private BlockState cogwheel() {
private IBakedModel cogwheel() {
float t = 25;
GlStateManager.translatef(t, -t, -t);
GlStateManager.rotated(getCurrentAngle() * 2, 0, 1, 0);
GlStateManager.translatef(-t, t, t);
return AllBlocks.SHAFTLESS_COGWHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Y);
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
}
private BlockState body() {
return AllBlocks.MECHANICAL_MIXER.get().getDefaultState();
}
private BlockState pole() {
private IBakedModel pole() {
GlStateManager.translatef(0, 51, 0);
return AllBlocks.MECHANICAL_MIXER_POLE.get().getDefaultState();
return AllBlockPartials.MECHANICAL_MIXER_POLE.get();
}
private BlockState head() {
private IBakedModel head() {
float t = 25;
GlStateManager.translatef(0, 51, 0);
GlStateManager.translatef(t, -t, -t);
GlStateManager.rotated(getCurrentAngle() * 4, 0, 1, 0);
GlStateManager.translatef(-t, t, t);
return AllBlocks.MECHANICAL_MIXER_HEAD.get().getDefaultState();
return AllBlockPartials.MECHANICAL_MIXER_HEAD.get();
}
private BlockState basin() {

View file

@ -3,11 +3,13 @@ package com.simibubi.create.compat.jei.category.animations;
import static com.simibubi.create.foundation.utility.AnimationTickHolder.ticks;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
@ -49,7 +51,7 @@ public class AnimatedPress extends AnimatedKinetics {
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
ScreenElementRenderer.renderBlock(this::head);
ScreenElementRenderer.renderModel(this::head);
GlStateManager.popMatrix();
if (basin) {
@ -63,18 +65,18 @@ public class AnimatedPress extends AnimatedKinetics {
private BlockState shaft() {
float t = 25;
GlStateManager.translatef(t, -t, t);
GlStateManager.rotated(getCurrentAngle() * 2, 0, 0, 1);
GlStateManager.translatef(-t, t, -t);
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
GlStateManager.translatef(t, -t, -t);
GlStateManager.rotated(getCurrentAngle() * 2, 1, 0, 0);
GlStateManager.translatef(-t, t, t);
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Z);
}
private BlockState body() {
return AllBlocks.MECHANICAL_PRESS.get().getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING,
Direction.EAST);
Direction.SOUTH);
}
private BlockState head() {
private IBakedModel head() {
float cycle = (ticks + Minecraft.getInstance().getRenderPartialTicks()) % 30;
float verticalOffset = 0;
if (cycle < 10) {
@ -88,8 +90,7 @@ public class AnimatedPress extends AnimatedKinetics {
verticalOffset = 0;
}
GlStateManager.translated(0, -verticalOffset * 50, 0);
return AllBlocks.MECHANICAL_PRESS_HEAD.get().getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING,
Direction.EAST);
return AllBlockPartials.MECHANICAL_PRESS_HEAD.get();
}
private BlockState basin() {

View file

@ -2,14 +2,12 @@ package com.simibubi.create.foundation.behaviour.base;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.behaviour.linked.LinkRenderer;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
public class SmartTileEntityRenderer<T extends SmartTileEntity> extends TileEntityRenderer<T> {
public class SmartTileEntityRenderer<T extends SmartTileEntity> extends SafeTileEntityRenderer<T> {
@Override
public void render(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
super.render(tileEntityIn, x, y, z, partialTicks, destroyStage);
public void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage);
LinkRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage);
}

View file

@ -1,7 +1,19 @@
package com.simibubi.create.foundation.block;
public interface IHaveColoredVertices {
import com.simibubi.create.foundation.block.render.ColoredVertexModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public interface IHaveColoredVertices extends IHaveCustomBlockModel {
public int getColor(float x, float y, float z);
@Override
@OnlyIn(Dist.CLIENT)
default IBakedModel createModel(IBakedModel original) {
return new ColoredVertexModel(original, this);
}
}

View file

@ -0,0 +1,14 @@
package com.simibubi.create.foundation.block;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public interface IHaveCustomBlockModel {
@OnlyIn(value = Dist.CLIENT)
public IBakedModel createModel(@Nullable IBakedModel original);
}

View file

@ -1,18 +0,0 @@
package com.simibubi.create.foundation.block;
import net.minecraft.block.RotatedPillarBlock;
import net.minecraft.block.material.Material;
import net.minecraft.util.BlockRenderLayer;
public class RenderUtilityAxisBlock extends RotatedPillarBlock implements IRenderUtilityBlock {
public RenderUtilityAxisBlock() {
super(Properties.create(Material.AIR));
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
}

View file

@ -1,11 +0,0 @@
package com.simibubi.create.foundation.block;
import net.minecraft.block.material.Material;
public class RenderUtilityDirectionalBlock extends ProperDirectionalBlock implements IRenderUtilityBlock {
public RenderUtilityDirectionalBlock() {
super(Properties.create(Material.AIR));
}
}

View file

@ -0,0 +1,33 @@
package com.simibubi.create.foundation.block;
import net.minecraft.block.Blocks;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.tileentity.TileEntity;
public abstract class SafeTileEntityRenderer<T extends TileEntity> extends TileEntityRenderer<T> {
@Override
public final void render(T te, double x, double y, double z, float partialTicks, int destroyStage) {
if (isInvalid(te))
return;
renderWithGL(te, x, y, z, partialTicks, destroyStage);
}
protected abstract void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage);
@Override
public final void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
BufferBuilder buffer) {
if (isInvalid(te))
return;
renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
}
protected void renderFast(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) {
}
public boolean isInvalid(T te) {
return te.getBlockState().getBlock() == Blocks.AIR;
}
}

View file

@ -0,0 +1,25 @@
package com.simibubi.create.foundation.block;
import net.minecraft.block.Blocks;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.model.animation.TileEntityRendererFast;
public abstract class SafeTileEntityRendererFast<T extends TileEntity> extends TileEntityRendererFast<T> {
@Override
public final void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
BufferBuilder buffer) {
if (isInvalid(te))
return;
renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
}
protected abstract void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
BufferBuilder buffer);
public boolean isInvalid(T te) {
return te.getBlockState().getBlock() == Blocks.AIR;
}
}

View file

@ -1,7 +1,19 @@
package com.simibubi.create.foundation.block.connected;
public interface IHaveConnectedTextures {
import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public interface IHaveConnectedTextures extends IHaveCustomBlockModel {
public ConnectedTextureBehaviour getBehaviour();
@Override
@OnlyIn(Dist.CLIENT)
default IBakedModel createModel(IBakedModel original) {
return new CTModel(original, this);
}
}

View file

@ -1,6 +1,6 @@
package com.simibubi.create.foundation.block.render;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.block.BlockState;
@ -8,24 +8,24 @@ import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.model.animation.TileEntityRendererFast;
public abstract class ColoredOverlayTileEntityRenderer<T extends TileEntity> extends TileEntityRendererFast<T> {
public abstract class ColoredOverlayTileEntityRenderer<T extends TileEntity> extends SafeTileEntityRendererFast<T> {
@Override
public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
public void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
BufferBuilder buffer) {
SuperByteBuffer render = render(getWorld(), te.getPos(), getOverlayState(te), getColor(te, partialTicks));
SuperByteBuffer render = render(getWorld(), te.getPos(), te.getBlockState(), getOverlayBuffer(te),
getColor(te, partialTicks));
buffer.putBulkData(render.translate(x, y, z).build());
}
protected abstract int getColor(T te, float partialTicks);
protected abstract BlockState getOverlayState(T te);
protected abstract SuperByteBuffer getOverlayBuffer(T te);
public static SuperByteBuffer render(World world, BlockPos pos, BlockState state, int color) {
public static SuperByteBuffer render(World world, BlockPos pos, BlockState state, SuperByteBuffer buffer,
int color) {
int packedLightmapCoords = state.getPackedLightmapCoords(world, pos);
SuperByteBuffer buffer = CreateClient.bufferCache.renderGenericBlockModel(state);
return buffer.color(color).light(packedLightmapCoords);
}

View file

@ -59,9 +59,10 @@ public abstract class CustomRenderedItemModel extends WrappedBakedModel {
this.partials.put(name, null);
}
public void loadPartials(ModelBakeEvent event) {
public CustomRenderedItemModel loadPartials(ModelBakeEvent event) {
for (String name : partials.keySet())
partials.put(name, loadModel(event, name));
return this;
}
private IBakedModel loadModel(ModelBakeEvent event, String name) {

View file

@ -8,10 +8,13 @@ import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.utility.ColorHelper;
import net.minecraft.block.BlockState;
import net.minecraft.block.FireBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
@ -40,6 +43,15 @@ public class ScreenElementRenderer {
}
public static void renderBlock(Supplier<BlockState> transformsAndState, int color) {
render(transformsAndState, null, -1);
}
public static void renderModel(Supplier<IBakedModel> transformsAndModel) {
render(null, transformsAndModel, -1);
}
private static void render(Supplier<BlockState> transformsAndState, Supplier<IBakedModel> transformsAndModel,
int color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
@ -51,32 +63,47 @@ public class ScreenElementRenderer {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.translated(0, 0, 200);
BlockState toRender = transformsAndState.get();
GlStateManager.scaled(50, -50, 50);
Minecraft mc = Minecraft.getInstance();
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher();
IBakedModel modelToRender = null;
BlockState blockToRender = null;
boolean stateMode = transformsAndModel == null;
boolean fire = false;
if (color == -1) {
mc.getBlockRendererDispatcher().renderBlockBrightness(toRender, 1);
if (stateMode) {
blockToRender = transformsAndState.get();
fire = (blockToRender.getBlock() instanceof FireBlock);
modelToRender = blockRenderer.getModelForState(blockToRender);
} else {
GlStateManager.disableLighting();
GlStateManager.rotated(90, 0, 1, 0);
Vec3d rgb = ColorHelper.getRGB(color);
mc.getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(
mc.getBlockRendererDispatcher().getModelForState(toRender), 1, (float) rgb.x, (float) rgb.y,
(float) rgb.z);
GlStateManager.enableLighting();
modelToRender = transformsAndModel.get();
}
if (!toRender.getFluidState().isEmpty()) {
GlStateManager.scaled(50, -50, 50);
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.pushMatrix();
if (fire) {
blockRenderer.renderBlockBrightness(blockToRender, 1);
} else {
GlStateManager.rotated(90, 0, 1, 0);
if (color == -1) {
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1);
} else {
Vec3d rgb = ColorHelper.getRGB(color);
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, (float) rgb.x,
(float) rgb.y, (float) rgb.z);
}
}
GlStateManager.popMatrix();
if (stateMode && !blockToRender.getFluidState().isEmpty()) {
RenderHelper.disableStandardItemLighting();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.setTranslation(0, -300, 0);
bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
mc.getBlockRendererDispatcher().renderFluid(new BlockPos(0, 300, 0), mc.world, bufferbuilder,
toRender.getFluidState());
blockRenderer.renderFluid(new BlockPos(0, 300, 0), mc.world, bufferbuilder, blockToRender.getFluidState());
Tessellator.getInstance().draw();
bufferbuilder.setTranslation(0, 0, 0);
}

View file

@ -91,7 +91,10 @@ public class AllShapes {
makeCuboidShape(0, 14, 0, 16, 16, 16)),
BASIN_BLOCK_SHAPE = VoxelShapes.or(
makeCuboidShape(2, 0, 2, 14, 2, 14),
makeCuboidShape(0, 2, 0, 16, 13, 16)),
VoxelShapes.combine(
makeCuboidShape(0, 2, 0, 16, 13, 16),
makeCuboidShape(2, 5, 2, 14, 14, 14),
IBooleanFunction.ONLY_FIRST)),
CRUSHING_WHEEL_COLLISION_SHAPE = makeCuboidShape(0, 0, 0, 16, 22, 16),
MECHANICAL_PROCESSOR_SHAPE = VoxelShapes.combineAndSimplify(
VoxelShapes.fullCube(),

View file

@ -11,5 +11,13 @@ public class AngleHelper {
angle = -angle;
return angle;
}
public static float verticalAngle(Direction facing) {
return facing == Direction.UP ? -90 : facing == Direction.DOWN ? 90 : 0;
}
public static float rad(float angle) {
return (float) (angle / 180 * Math.PI);
}
}

View file

@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL11;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.simibubi.create.AllBlockPartials;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
@ -28,22 +29,29 @@ public class SuperByteBufferCache {
}
public static final Compartment<BlockState> GENERIC_TILE = new Compartment<>();
public static final Compartment<AllBlockPartials> PARTIAL = new Compartment<>();
Map<Compartment<?>, Cache<Object, SuperByteBuffer>> cache;
public SuperByteBufferCache() {
cache = new HashMap<>();
registerCompartment(GENERIC_TILE);
registerCompartment(PARTIAL);
}
public SuperByteBuffer renderGenericBlockModel(BlockState toRender) {
public SuperByteBuffer renderBlock(BlockState toRender) {
return getGeneric(toRender, () -> standardBlockRender(toRender));
}
public SuperByteBuffer renderPartial(AllBlockPartials partial, BlockState referenceState) {
return get(PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState));
}
public SuperByteBuffer renderBlockState(Compartment<BlockState> compartment, BlockState toRender) {
public SuperByteBuffer renderBlockIn(Compartment<BlockState> compartment, BlockState toRender) {
return get(compartment, toRender, () -> standardBlockRender(toRender));
}
public SuperByteBuffer getGeneric(BlockState key, Supplier<SuperByteBuffer> supplier) {
SuperByteBuffer getGeneric(BlockState key, Supplier<SuperByteBuffer> supplier) {
return get(GENERIC_TILE, key, supplier);
}
@ -67,18 +75,22 @@ public class SuperByteBufferCache {
}
private SuperByteBuffer standardBlockRender(BlockState renderedState) {
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
return standardModelRender(dispatcher.getModelForState(renderedState), renderedState);
}
private SuperByteBuffer standardModelRender(IBakedModel model, BlockState referenceState) {
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer();
IBakedModel originalModel = dispatcher.getModelForState(renderedState);
BufferBuilder builder = new BufferBuilder(0);
Random random = new Random();
builder.setTranslation(0, 1, 0);
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
blockRenderer.renderModelFlat(Minecraft.getInstance().world, originalModel, renderedState, BlockPos.ZERO.down(),
blockRenderer.renderModelFlat(Minecraft.getInstance().world, model, referenceState, BlockPos.ZERO.down(),
builder, true, random, 42, EmptyModelData.INSTANCE);
builder.finishDrawing();
return new SuperByteBuffer(builder.getByteBuffer());
}

View file

@ -55,6 +55,7 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
protected boolean initNetwork;
// Client
int overStressedTime;
float overStressedEffect;
public KineticTileEntity(TileEntityType<?> typeIn) {
@ -168,15 +169,8 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
public void readClientUpdate(CompoundNBT tag) {
boolean overStressedBefore = overStressed;
super.readClientUpdate(tag);
if (overStressedBefore != overStressed && speed != 0) {
if (overStressed) {
overStressedEffect = 1;
spawnEffect(ParticleTypes.SMOKE, 0.2f, 5);
} else {
overStressedEffect = -1;
spawnEffect(ParticleTypes.CLOUD, .075f, 2);
}
}
if (overStressedBefore != overStressed && speed != 0)
overStressedTime = overStressedTime == 0 ? 2 : 0;
}
public boolean isSource() {
@ -284,6 +278,16 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
super.tick();
if (world.isRemote) {
if (overStressedTime > 0)
if (--overStressedTime == 0)
if (overStressed) {
overStressedEffect = 1;
spawnEffect(ParticleTypes.SMOKE, 0.2f, 5);
} else {
overStressedEffect = -1;
spawnEffect(ParticleTypes.CLOUD, .075f, 2);
}
if (overStressedEffect != 0) {
overStressedEffect -= overStressedEffect * .1f;
if (Math.abs(overStressedEffect) < 1 / 128f)

View file

@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.base;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
@ -14,31 +15,35 @@ import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.model.animation.TileEntityRendererFast;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber(value = Dist.CLIENT)
public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTileEntity> {
public class KineticTileEntityRenderer extends SafeTileEntityRendererFast<KineticTileEntity> {
public static final Compartment<BlockState> KINETIC_TILE = new Compartment<>();
public static boolean rainbowMode = false;
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
renderRotatingKineticBlock(te, getWorld(), getRenderedBlockState(te), x, y, z, buffer);
renderRotatingBuffer(te, getWorld(), getRotatedModel(te), x, y, z, buffer);
}
public static void renderRotatingKineticBlock(KineticTileEntity te, World world, BlockState renderedState, double x,
double y, double z, BufferBuilder buffer) {
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, renderedState);
buffer.putBulkData(standardKineticRotationTransform(superByteBuffer, te, world).translate(x, y, z).build());
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState);
renderRotatingBuffer(te, world, superByteBuffer, x, y, z, buffer);
}
public static void renderRotatingBuffer(KineticTileEntity te, World world, SuperByteBuffer superBuffer, double x,
double y, double z, BufferBuilder buffer) {
buffer.putBulkData(standardKineticRotationTransform(superBuffer, te, world).translate(x, y, z).build());
}
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
float time = AnimationTickHolder.getRenderTick();
float offset = getRotationOffsetForPosition(te, pos, axis);
float angle = ((time * te.getSpeed() * 3f/10 + offset) % 360) / 180 * (float) Math.PI;
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
return angle;
}
@ -63,8 +68,8 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
else
buffer.color(white);
} else {
if (te.overStressedEffect != 0)
if (te.overStressedEffect > 0)
if (te.overStressedEffect != 0)
if (te.overStressedEffect > 0)
buffer.color(ColorHelper.mixColors(white, 0xFF0000, te.overStressedEffect));
else
buffer.color(ColorHelper.mixColors(white, 0x00FFBB, -te.overStressedEffect));
@ -89,4 +94,8 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
return te.getBlockState();
}
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
return CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, getRenderedBlockState(te));
}
}

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.components.actors;
import java.util.List;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
@ -13,11 +12,9 @@ import com.simibubi.create.modules.contraptions.components.contraptions.IHaveMov
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.DirectionalBlock;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
@ -119,18 +116,4 @@ public class DrillBlock extends DirectionalKineticBlock
}
}
public static class DrillHeadBlock extends DirectionalBlock implements IRenderUtilityBlock {
public DrillHeadBlock() {
super(Properties.from(Blocks.AIR));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(FACING);
super.fillStateContainer(builder);
}
}
}

View file

@ -2,8 +2,7 @@ package com.simibubi.create.modules.contraptions.components.actors;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper;
@ -18,17 +17,17 @@ import net.minecraft.util.Direction.Axis;
public class DrillTileEntityRenderer extends KineticTileEntityRenderer {
@Override
protected BlockState getRenderedBlockState(KineticTileEntity te) {
return getRenderedBlockState(te.getBlockState());
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
return getRotatingModel(te.getBlockState());
}
private static BlockState getRenderedBlockState(BlockState state) {
return AllBlocks.DRILL_HEAD.get().getDefaultState().with(FACING, state.get(FACING));
protected static SuperByteBuffer getRotatingModel(BlockState state) {
return AllBlockPartials.DRILL.renderOnDirectional(state);
}
public static SuperByteBuffer renderInContraption(MovementContext context) {
BlockState state = context.state;
SuperByteBuffer buffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, getRenderedBlockState(state));
SuperByteBuffer buffer = getRotatingModel(state);
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, state.get(FACING).getOpposite())
? context.getAnimationSpeed()

View file

@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.components.actors;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper;
@ -220,23 +219,4 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha
return Blocks.AIR.getDefaultState();
}
public static class HarvesterBladeBlock extends HorizontalBlock implements IRenderUtilityBlock {
public HarvesterBladeBlock() {
super(Properties.from(Blocks.AIR));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING);
super.fillStateContainer(builder);
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.SOLID;
}
}
}

View file

@ -1,10 +1,9 @@
package com.simibubi.create.modules.contraptions.components.actors;
import static com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer.KINETIC_TILE;
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper;
@ -12,16 +11,15 @@ import com.simibubi.create.modules.contraptions.components.contraptions.IHaveMov
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class HarvesterTileEntityRenderer extends TileEntityRenderer<HarvesterTileEntity> {
public class HarvesterTileEntityRenderer extends SafeTileEntityRendererFast<HarvesterTileEntity> {
@Override
public void renderTileEntityFast(HarvesterTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(HarvesterTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
SuperByteBuffer superBuffer = renderHead(getWorld(), te.getPos(), te.getBlockState(), 0);
superBuffer.translate(x, y, z).renderInto(buffer);
@ -39,10 +37,7 @@ public class HarvesterTileEntityRenderer extends TileEntityRenderer<HarvesterTil
}
public static SuperByteBuffer renderHead(World world, BlockPos pos, BlockState state, float angle) {
BlockState renderedState = AllBlocks.HARVESTER_BLADE.get().getDefaultState().with(HORIZONTAL_FACING,
state.get(HORIZONTAL_FACING));
SuperByteBuffer buffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, renderedState);
SuperByteBuffer buffer = AllBlockPartials.HARVESTER_BLADE.renderOnHorizontal(state);
int lightMapCoords = state.getPackedLightmapCoords(world, pos);
Direction facing = state.get(HORIZONTAL_FACING);
Axis axis = facing.rotateYCCW().getAxis();

View file

@ -1,38 +1,39 @@
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
public class MechanicalBearingTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
MechanicalBearingTileEntity bearingTe = (MechanicalBearingTileEntity) te;
final Direction facing = te.getBlockState().get(BlockStateProperties.FACING);
BlockState capState = AllBlocks.MECHANICAL_BEARING_TOP.get().getDefaultState().with(BlockStateProperties.FACING,
facing);
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, capState);
SuperByteBuffer superBuffer = AllBlockPartials.MECHANICAL_BEARING_TOP.renderOn(te.getBlockState());
superBuffer.rotateCentered(Axis.X, AngleHelper.rad(-90 - AngleHelper.verticalAngle(facing)));
if (facing.getAxis().isHorizontal())
superBuffer.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(facing.getOpposite())));
float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks);
kineticRotationTransform(superBuffer, bearingTe, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI), getWorld());
kineticRotationTransform(superBuffer, bearingTe, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI),
getWorld());
superBuffer.translate(x, y, z).renderInto(buffer);
}
@Override
protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocks.SHAFT_HALF.get().getDefaultState().with(BlockStateProperties.FACING,
te.getBlockState().get(BlockStateProperties.FACING).getOpposite());
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
return AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(),
te.getBlockState().get(MechanicalBearingBlock.FACING).getOpposite());
}
}

View file

@ -12,9 +12,9 @@ import net.minecraft.state.properties.BlockStateProperties;
public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
}
@Override

View file

@ -174,7 +174,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock
return true;
}
if (crafter.phase == Phase.IDLE && !isHand) {
if (crafter.phase == Phase.IDLE && !isHand && !AllItems.WRENCH.typeOf(heldItem)) {
if (worldIn.isRemote)
return true;
LazyOptional<IItemHandler> capability = crafter

View file

@ -1,15 +1,17 @@
package com.simibubi.create.modules.contraptions.components.crafter;
import static com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
import static com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer.standardKineticRotationTransform;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import com.simibubi.create.foundation.block.render.SpriteShifter;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase;
import com.simibubi.create.modules.contraptions.components.crafter.RecipeGridHandler.GroupedItems;
@ -19,10 +21,8 @@ import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
@ -30,20 +30,16 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@SuppressWarnings("deprecation")
public class MechanicalCrafterTileEntityRenderer extends TileEntityRenderer<MechanicalCrafterTileEntity> {
public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<MechanicalCrafterTileEntity> {
public static SpriteShiftEntry animatedTexture = SpriteShifter.get("block/crafter_thingies",
"block/crafter_thingies");
@Override
public void render(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks,
public void renderWithGL(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage) {
super.render(te, x, y, z, partialTicks, destroyStage);
if (!AllBlocks.MECHANICAL_CRAFTER.typeOf(te.getBlockState()))
return;
GlStateManager.pushMatrix();
Direction facing = te.getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING);
Direction facing = te.getBlockState().get(HORIZONTAL_FACING);
Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.58).add(.5, .5, .5);
if (te.phase == Phase.EXPORTING) {
@ -137,24 +133,27 @@ public class MechanicalCrafterTileEntityRenderer extends TileEntityRenderer<Mech
}
@Override
public void renderTileEntityFast(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
BlockState blockState = te.getBlockState();
BlockState renderedState = AllBlocks.SHAFTLESS_COGWHEEL.get().getDefaultState().with(BlockStateProperties.AXIS,
blockState.get(MechanicalCrafterBlock.HORIZONTAL_FACING).getAxis());
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getWorld(), renderedState, x, y, z, buffer);
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2));
superBuffer.rotateCentered(Axis.Y,
(float) (blockState.get(HORIZONTAL_FACING).getAxis() != Axis.X ? 0 : Math.PI / 2));
standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z).renderInto(buffer);
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(blockState);
BlockPos pos = te.getPos();
if (te.phase != Phase.IDLE && te.phase != Phase.CRAFTING && te.phase != Phase.INSERTING) {
SuperByteBuffer lidBuffer = renderAndTransform(AllBlocks.MECHANICAL_CRAFTER_LID, blockState, pos);
SuperByteBuffer lidBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_LID, blockState, pos);
lidBuffer.translate(x, y, z).renderInto(buffer);
}
if (MechanicalCrafterBlock.isValidTarget(getWorld(), pos.offset(targetDirection), blockState)) {
SuperByteBuffer beltBuffer = renderAndTransform(AllBlocks.MECHANICAL_CRAFTER_BELT, blockState, pos);
SuperByteBuffer beltFrameBuffer = renderAndTransform(AllBlocks.MECHANICAL_CRAFTER_BELT_FRAME, blockState,
SuperByteBuffer beltBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState, pos);
SuperByteBuffer beltFrameBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState,
pos);
if (te.phase == Phase.EXPORTING) {
@ -169,16 +168,16 @@ public class MechanicalCrafterTileEntityRenderer extends TileEntityRenderer<Mech
beltFrameBuffer.translate(x, y, z).renderInto(buffer);
} else {
SuperByteBuffer arrowBuffer = renderAndTransform(AllBlocks.MECHANICAL_CRAFTER_ARROW, blockState, pos);
SuperByteBuffer arrowBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState, pos);
arrowBuffer.translate(x, y, z).renderInto(buffer);
}
}
private SuperByteBuffer renderAndTransform(AllBlocks renderBlock, BlockState crafterState, BlockPos pos) {
SuperByteBuffer buffer = CreateClient.bufferCache.renderGenericBlockModel(renderBlock.getDefault());
private SuperByteBuffer renderAndTransform(AllBlockPartials renderBlock, BlockState crafterState, BlockPos pos) {
SuperByteBuffer buffer = renderBlock.renderOn(crafterState);
float xRot = crafterState.get(MechanicalCrafterBlock.POINTING).getXRotation();
float yRot = AngleHelper.horizontalAngle(crafterState.get(MechanicalCrafterBlock.HORIZONTAL_FACING));
float yRot = AngleHelper.horizontalAngle(crafterState.get(HORIZONTAL_FACING));
buffer.rotateCentered(Axis.X, (float) ((xRot) / 180 * Math.PI));
buffer.rotateCentered(Axis.Y, (float) ((yRot + 90) / 180 * Math.PI));
buffer.light(crafterState.getPackedLightmapCoords(getWorld(), pos));

View file

@ -2,8 +2,7 @@ package com.simibubi.create.modules.contraptions.components.crank;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
@ -15,17 +14,13 @@ import net.minecraft.util.Direction;
public class HandCrankTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
BlockState state = te.getBlockState();
if (!AllBlocks.HAND_CRANK.typeOf(state))
return;
Direction facing = state.get(FACING);
SuperByteBuffer handle = CreateClient.bufferCache
.renderGenericBlockModel(AllBlocks.HAND_CRANK_HANDLE.getDefault().with(FACING, facing));
SuperByteBuffer handle = AllBlockPartials.HAND_CRANK_HANDLE.renderOnDirectional(state, facing.getOpposite());
HandCrankTileEntity crank = (HandCrankTileEntity) te;
kineticRotationTransform(handle, te, facing.getAxis(),
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360, getWorld());

View file

@ -12,6 +12,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.collect.Multimap;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour;
@ -540,9 +541,9 @@ public class DeployerTileEntity extends KineticTileEntity {
player = null;
}
public AllBlocks getHandPose() {
return mode == Mode.PUNCH ? AllBlocks.DEPLOYER_HAND_PUNCHING
: heldItem.isEmpty() ? AllBlocks.DEPLOYER_HAND_POINTING : AllBlocks.DEPLOYER_HAND_HOLDING;
public AllBlockPartials getHandPose() {
return mode == Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING
: heldItem.isEmpty() ? AllBlockPartials.DEPLOYER_HAND_POINTING : AllBlockPartials.DEPLOYER_HAND_HOLDING;
}
@Override

View file

@ -5,9 +5,10 @@ import static com.simibubi.create.modules.contraptions.base.DirectionalKineticBl
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.TessellatorHelper;
@ -25,7 +26,6 @@ import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.BlockItem;
import net.minecraft.util.Direction;
@ -35,13 +35,10 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@SuppressWarnings("deprecation")
public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileEntity> {
public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerTileEntity> {
@Override
public void render(DeployerTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
if (!AllBlocks.DEPLOYER.typeOf(te.getBlockState()))
return;
public void renderWithGL(DeployerTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
renderItem(te, x, y, z, partialTicks);
FilteringRenderer.renderOnTileEntity(te, x, y, z, partialTicks, destroyStage);
renderComponents(te, x, y, z, partialTicks);
@ -87,7 +84,7 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
BlockState blockState = te.getBlockState();
BlockPos pos = te.getPos();
SuperByteBuffer pole = renderAndTransform(AllBlocks.DEPLOYER_POLE, blockState, pos, true);
SuperByteBuffer pole = renderAndTransform(AllBlockPartials.DEPLOYER_POLE, blockState, pos, true);
SuperByteBuffer hand = renderAndTransform(te.getHandPose(), blockState, pos, false);
Vec3d offset = getHandOffset(te, partialTicks, blockState);
@ -104,8 +101,8 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
if (te.state == State.RETRACTING)
progress = (te.timer - partialTicks * te.getTimerSpeed()) / 1000f;
float handLength = te.getHandPose() == AllBlocks.DEPLOYER_HAND_POINTING ? 0
: te.getHandPose() == AllBlocks.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
float handLength = te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
: te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21 / 16f);
Vec3d offset = new Vec3d(blockState.get(FACING).getDirectionVec()).scale(distance);
return offset;
@ -118,9 +115,9 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
}
private SuperByteBuffer renderAndTransform(AllBlocks renderBlock, BlockState deployerState, BlockPos pos,
private SuperByteBuffer renderAndTransform(AllBlockPartials renderBlock, BlockState deployerState, BlockPos pos,
boolean axisDirectionMatters) {
SuperByteBuffer buffer = CreateClient.bufferCache.renderGenericBlockModel(renderBlock.getDefault());
SuperByteBuffer buffer = renderBlock.renderOn(deployerState);
Direction facing = deployerState.get(FACING);
float zRotFirst = axisDirectionMatters

View file

@ -2,23 +2,25 @@ package com.simibubi.create.modules.contraptions.components.fan;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper;
public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
Direction direction = te.getBlockState().get(FACING);
SuperByteBuffer superBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(),
direction.getOpposite());
standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z).renderInto(buffer);
float time = AnimationTickHolder.getRenderTick();
float speed = te.getSpeed() * 5;
@ -26,23 +28,13 @@ public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
speed = MathHelper.clamp(speed, 80, 64 * 20);
if (speed < 0)
speed = MathHelper.clamp(speed, -64 * 20, -80);
float angle = (time * speed * 3/10f) % 360;
float angle = (time * speed * 3 / 10f) % 360;
angle = angle / 180f * (float) Math.PI;
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE,
getRenderedPropellerState(te));
kineticRotationTransform(superByteBuffer, te, te.getBlockState().get(FACING).getAxis(), angle, getWorld());
SuperByteBuffer superByteBuffer = AllBlockPartials.ENCASED_FAN_INNER.renderOnDirectional(te.getBlockState(),
direction.getOpposite());
kineticRotationTransform(superByteBuffer, te, direction.getAxis(), angle, getWorld());
superByteBuffer.translate(x, y, z).renderInto(buffer);
}
@Override
protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocks.SHAFT_HALF.get().getDefaultState().with(FACING, te.getBlockState().get(FACING).getOpposite());
}
protected BlockState getRenderedPropellerState(KineticTileEntity te) {
return AllBlocks.ENCASED_FAN_INNER.get().getDefaultState().with(FACING, te.getBlockState().get(FACING));
}
}

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.components.mixer;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -9,39 +8,33 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
BlockState blockState = te.getBlockState();
MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te;
BlockState poleState = AllBlocks.MECHANICAL_MIXER_POLE.get().getDefaultState();
BlockState headState = AllBlocks.MECHANICAL_MIXER_HEAD.get().getDefaultState();
BlockPos pos = te.getPos();
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z).renderInto(buffer);
int packedLightmapCoords = poleState.getPackedLightmapCoords(getWorld(), pos);
int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), pos);
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
float time = AnimationTickHolder.getRenderTick();
float angle = (float) (((time * speed * 6 / 10f) % 360) / 180 * (float) Math.PI);
SuperByteBuffer poleRender = CreateClient.bufferCache.renderGenericBlockModel(poleState);
SuperByteBuffer poleRender = AllBlockPartials.MECHANICAL_MIXER_POLE.renderOn(blockState);
poleRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
SuperByteBuffer headRender = CreateClient.bufferCache.renderGenericBlockModel(headState);
SuperByteBuffer headRender = AllBlockPartials.MECHANICAL_MIXER_HEAD.renderOn(blockState);
headRender.rotateCentered(Axis.Y, angle).translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords)
.renderInto(buffer);
}
@Override
protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocks.SHAFTLESS_COGWHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Y);
}
}

View file

@ -1,18 +1,15 @@
package com.simibubi.create.modules.contraptions.components.motor;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.state.properties.BlockStateProperties;
public class MotorTileEntityRenderer extends KineticTileEntityRenderer {
@Override
protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocks.SHAFT_HALF.get().getDefaultState().with(BlockStateProperties.FACING,
te.getBlockState().get(BlockStateProperties.HORIZONTAL_FACING));
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
return AllBlockPartials.SHAFT_HALF.renderOnHorizontal(te.getBlockState());
}
}

View file

@ -6,7 +6,6 @@ import java.util.Optional;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.SyncedTileEntity;
import com.simibubi.create.foundation.item.ItemHelper;
@ -24,12 +23,10 @@ import com.simibubi.create.modules.contraptions.relays.belt.TransportedItemStack
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
@ -189,19 +186,6 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return false;
}
public static class Head extends HorizontalBlock implements IRenderUtilityBlock {
public Head() {
super(Properties.from(Blocks.AIR));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING);
super.fillStateContainer(builder);
}
}
@Override
public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) {
return new BasinOperatorBlockItem(AllBlocks.MECHANICAL_PRESS, properties);

View file

@ -2,8 +2,8 @@ package com.simibubi.create.modules.contraptions.components.press;
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
@ -16,16 +16,16 @@ import net.minecraft.util.math.BlockPos;
public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
BlockState state = getRenderedHeadBlockState(te);
BlockPos pos = te.getPos();
int packedLightmapCoords = state.getPackedLightmapCoords(getWorld(), pos);
BlockState blockState = te.getBlockState();
int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), pos);
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
SuperByteBuffer headRender = CreateClient.bufferCache.renderGenericBlockModel(state);
SuperByteBuffer headRender = AllBlockPartials.MECHANICAL_PRESS_HEAD.renderOnHorizontal(blockState);
headRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
}
@ -35,9 +35,4 @@ public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer
te.getBlockState().get(HORIZONTAL_FACING).getAxis());
}
protected BlockState getRenderedHeadBlockState(KineticTileEntity te) {
return AllBlocks.MECHANICAL_PRESS_HEAD.get().getDefaultState().with(HORIZONTAL_FACING,
te.getBlockState().get(HORIZONTAL_FACING));
}
}

View file

@ -4,8 +4,12 @@ import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -17,17 +21,17 @@ import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.MathHelper;
@SuppressWarnings("deprecation")
public class SawTileEntityRenderer extends TileEntityRenderer<SawTileEntity> {
public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity> {
@Override
public void render(SawTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
public void renderWithGL(SawTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
renderItems(te, x, y, z, partialTicks);
FilteringRenderer.renderOnTileEntity(te, x, y, z, partialTicks, destroyStage);
renderShaft(te, x, y, z);
@ -36,7 +40,7 @@ public class SawTileEntityRenderer extends TileEntityRenderer<SawTileEntity> {
protected void renderShaft(SawTileEntity te, double x, double y, double z) {
TessellatorHelper.prepareFastRender();
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getWorld(), getRenderedBlockState(te), x, y, z,
KineticTileEntityRenderer.renderRotatingBuffer(te, getWorld(), getRotatedModel(te), x, y, z,
Tessellator.getInstance().getBuffer());
TessellatorHelper.draw();
}
@ -74,11 +78,16 @@ public class SawTileEntityRenderer extends TileEntityRenderer<SawTileEntity> {
}
}
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
BlockState state = te.getBlockState();
if (state.get(FACING).getAxis().isHorizontal())
return AllBlockPartials.SHAFT_HALF.renderOnDirectional(state.rotate(Rotation.CLOCKWISE_180));
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
getRenderedBlockState(te));
}
protected BlockState getRenderedBlockState(KineticTileEntity te) {
BlockState state = te.getBlockState();
if (state.get(FACING).getAxis().isHorizontal()) {
return AllBlocks.SHAFT_HALF.block.getDefaultState().with(FACING, state.get(FACING).getOpposite());
}
return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
}

View file

@ -3,11 +3,11 @@ package com.simibubi.create.modules.contraptions.processing;
import java.util.Random;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@ -15,12 +15,10 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
@SuppressWarnings("deprecation")
public class BasinTileEntityRenderer extends TileEntityRenderer<BasinTileEntity> {
public class BasinTileEntityRenderer extends SafeTileEntityRenderer<BasinTileEntity> {
@Override
public void render(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) {
super.render(basin, x, y, z, partialTicks, destroyStage);
public void renderWithGL(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) {
GlStateManager.pushMatrix();
BlockPos pos = basin.getPos();
GlStateManager.translated(x + .5, y + .2f, z + .5);

View file

@ -1,7 +1,7 @@
package com.simibubi.create.modules.contraptions.redstone;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
@ -10,36 +10,28 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.state.properties.AttachFace;
import net.minecraft.util.Direction.Axis;
import net.minecraftforge.client.model.animation.TileEntityRendererFast;
public class AnalogLeverTileEntityRenderer extends TileEntityRendererFast<AnalogLeverTileEntity> {
public class AnalogLeverTileEntityRenderer extends SafeTileEntityRendererFast<AnalogLeverTileEntity> {
@Override
public void renderTileEntityFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
BlockState leverState = te.getBlockState();
if (!AllBlocks.ANALOG_LEVER.typeOf(leverState))
return;
int lightCoords = leverState.getPackedLightmapCoords(getWorld(), te.getPos());
float state = te.clientState.get(partialTicks);
// Handle
SuperByteBuffer handle = render(AllBlocks.ANALOG_LEVER_HANDLE);
SuperByteBuffer handle = AllBlockPartials.ANALOG_LEVER_HANDLE.renderOn(leverState);
float angle = (float) ((state / 15) * 90 / 180 * Math.PI);
handle.translate(-1 / 2f, -1 / 16f, -1 / 2f).rotate(Axis.X, angle).translate(1 / 2f, 1 / 16f, 1 / 2f);
transform(handle, leverState).light(lightCoords).translate(x, y, z).renderInto(buffer);
// Indicator
int color = ColorHelper.mixColors(0x2C0300, 0xCD0000, state / 15f);
SuperByteBuffer indicator = transform(render(AllBlocks.ANALOG_LEVER_INDICATOR), leverState);
SuperByteBuffer indicator = transform(AllBlockPartials.ANALOG_LEVER_INDICATOR.renderOn(leverState), leverState);
indicator.light(lightCoords).translate(x, y, z).color(color).renderInto(buffer);
}
private SuperByteBuffer render(AllBlocks model) {
return CreateClient.bufferCache.renderGenericBlockModel(model.getDefault());
}
private SuperByteBuffer transform(SuperByteBuffer buffer, BlockState leverState) {
AttachFace face = leverState.get(AnalogLeverBlock.FACE);
float rX = face == AttachFace.FLOOR ? 0 : face == AttachFace.WALL ? 90 : 180;

View file

@ -5,15 +5,16 @@ import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FAC
import java.util.Random;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import com.simibubi.create.foundation.block.render.SpriteShifter;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.IndependentShadowRenderer;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope;
@ -25,39 +26,35 @@ import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
@SuppressWarnings("deprecation")
public class BeltTileEntityRenderer extends TileEntityRenderer<BeltTileEntity> {
public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
private static SpriteShiftEntry animatedTexture;
@Override
public void render(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
super.render(te, x, y, z, partialTicks, destroyStage);
public void renderWithGL(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
TessellatorHelper.prepareFastRender();
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, Tessellator.getInstance().getBuffer());
TessellatorHelper.draw();
renderItems(te, x, y, z, partialTicks);
}
@Override
public void renderTileEntityFast(BeltTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(BeltTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
if (te.hasPulley())
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getWorld(), getPulleyState(te), x, y, z, buffer);
BlockState blockState = te.getBlockState();
if (!AllBlocks.BELT.typeOf(blockState))
return;
BlockState renderedState = getBeltState(te);
SuperByteBuffer beltBuffer = CreateClient.bufferCache.renderBlockState(KineticTileEntityRenderer.KINETIC_TILE,
SuperByteBuffer beltBuffer = CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
renderedState);
beltBuffer.color(te.color == -1 ? 0x808080 : te.color);
@ -68,7 +65,7 @@ public class BeltTileEntityRenderer extends TileEntityRenderer<BeltTileEntity> {
animatedTexture = SpriteShifter.get("block/belt", "block/belt_animated");
if (speed != 0) {
float time = AnimationTickHolder.getRenderTick()
* te.getBlockState().get(HORIZONTAL_FACING).getAxisDirection().getOffset();
* blockState.get(HORIZONTAL_FACING).getAxisDirection().getOffset();
if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X)
speed = -speed;
int textureIndex = (int) ((speed * time / 36) % 16);
@ -81,8 +78,17 @@ public class BeltTileEntityRenderer extends TileEntityRenderer<BeltTileEntity> {
beltBuffer.shiftUVtoSheet(animatedTexture.getOriginal(), animatedTexture.getTarget(), 0, 0);
}
int packedLightmapCoords = te.getBlockState().getPackedLightmapCoords(getWorld(), te.getPos());
int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), te.getPos());
beltBuffer.light(packedLightmapCoords).translate(x, y, z).renderInto(buffer);
if (te.hasPulley()) {
SuperByteBuffer superBuffer = AllBlockPartials.BELT_PULLEY.renderOn(blockState);
Axis axis = blockState.get(BeltBlock.HORIZONTAL_FACING).getAxis();
superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2));
superBuffer.rotateCentered(Axis.Y, (float) (axis == Axis.X ? 0 : Math.PI / 2));
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z)
.renderInto(buffer);
}
}
protected void renderItems(BeltTileEntity te, double x, double y, double z, float partialTicks) {
@ -175,11 +181,6 @@ public class BeltTileEntityRenderer extends TileEntityRenderer<BeltTileEntity> {
}
}
protected BlockState getPulleyState(KineticTileEntity te) {
return AllBlocks.BELT_PULLEY.get().getDefaultState().with(BlockStateProperties.AXIS,
((IRotate) AllBlocks.BELT.get()).getRotationAxis(te.getBlockState()));
}
protected BlockState getBeltState(KineticTileEntity te) {
return te.getBlockState().with(BeltBlock.CASING, false);
}

View file

@ -1,28 +1,24 @@
package com.simibubi.create.modules.contraptions.relays.belt;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.client.model.animation.TileEntityRendererFast;
public class BeltTunnelTileEntityRenderer extends TileEntityRendererFast<BeltTunnelTileEntity> {
public class BeltTunnelTileEntityRenderer extends SafeTileEntityRendererFast<BeltTunnelTileEntity> {
@Override
public void renderTileEntityFast(BeltTunnelTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(BeltTunnelTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
BlockState flapState = AllBlocks.BELT_TUNNEL_FLAP.get().getDefaultState();
BlockState indicatorState = AllBlocks.BELT_TUNNEL_INDICATOR.get().getDefaultState();
SuperByteBuffer flapBuffer = CreateClient.bufferCache.renderGenericBlockModel(flapState);
SuperByteBuffer indicatorBuffer = CreateClient.bufferCache.renderGenericBlockModel(indicatorState);
SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState());
SuperByteBuffer indicatorBuffer = AllBlockPartials.BELT_TUNNEL_INDICATOR.renderOn(te.getBlockState());
BlockPos pos = te.getPos();
World world = getWorld();

View file

@ -1,14 +0,0 @@
package com.simibubi.create.modules.contraptions.relays.elementary;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import net.minecraft.block.Blocks;
public class ShaftHalfBlock extends ProperDirectionalBlock implements IHaveNoBlockItem {
public ShaftHalfBlock() {
super(Properties.from(Blocks.AIR));
}
}

View file

@ -1,13 +1,11 @@
package com.simibubi.create.modules.contraptions.relays.encased;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
@ -17,10 +15,9 @@ import net.minecraft.util.math.BlockPos;
public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
final BlockState defaultState = AllBlocks.SHAFT_HALF.get().getDefaultState();
final BlockPos pos = te.getPos();
float time = AnimationTickHolder.getRenderTick();
@ -40,8 +37,8 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
angle += offset;
angle = angle / 180f * (float) Math.PI;
BlockState state = defaultState.with(BlockStateProperties.FACING, direction);
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, state);
SuperByteBuffer superByteBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(),
direction);
kineticRotationTransform(superByteBuffer, te, axis, angle, getWorld());
superByteBuffer.translate(x, y, z).renderInto(buffer);

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.relays.gauge;
import java.util.Random;
import com.simibubi.create.foundation.block.RenderUtilityBlock;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.Lang;
@ -16,9 +15,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.particles.RedstoneParticleData;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
@ -161,13 +157,4 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
return AllShapes.GAUGE.get(state.get(FACING), state.get(AXIS_ALONG_FIRST_COORDINATE));
}
public static class Head extends RenderUtilityBlock {
public static final IProperty<Type> TYPE = EnumProperty.create("type", Type.class);
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
super.fillStateContainer(builder.add(TYPE));
}
}
}

View file

@ -1,11 +1,12 @@
package com.simibubi.create.modules.contraptions.relays.gauge;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
@ -23,21 +24,16 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
}
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
BlockState gaugeState = te.getBlockState();
if (!(gaugeState.getBlock() instanceof GaugeBlock))
return;
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
int lightCoords = gaugeState.getPackedLightmapCoords(getWorld(), te.getPos());
BlockState head = AllBlocks.GAUGE_HEAD.get().getDefaultState().with(GaugeBlock.Head.TYPE, type);
BlockState dial = AllBlocks.GAUGE_DIAL.get().getDefaultState();
SuperByteBuffer headBuffer = CreateClient.bufferCache.renderGenericBlockModel(head);
SuperByteBuffer dialBuffer = CreateClient.bufferCache.renderGenericBlockModel(dial);
SuperByteBuffer headBuffer = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED
: AllBlockPartials.GAUGE_HEAD_STRESS).renderOn(gaugeState);
SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState);
for (Direction facing : Direction.values()) {
if (!((GaugeBlock) gaugeState.getBlock()).shouldRenderHeadOnFace(getWorld(), te.getPos(), gaugeState,

View file

@ -1,13 +1,11 @@
package com.simibubi.create.modules.contraptions.relays.gearbox;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
@ -17,19 +15,18 @@ import net.minecraft.util.math.BlockPos;
public class GearboxTileEntityRenderer extends KineticTileEntityRenderer {
@Override
public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
final BlockPos pos = te.getPos();
float time = AnimationTickHolder.getRenderTick();
final BlockState defaultState = AllBlocks.SHAFT_HALF.get().getDefaultState();
for (Direction direction : Direction.values()) {
final Axis axis = direction.getAxis();
if (boxAxis == axis)
continue;
BlockState state = defaultState.with(BlockStateProperties.FACING, direction);
SuperByteBuffer shaft = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), direction);
float offset = getRotationOffsetForPosition(te, pos, axis);
float angle = (time * te.getSpeed() * 3f / 10) % 360;
@ -45,9 +42,8 @@ public class GearboxTileEntityRenderer extends KineticTileEntityRenderer {
angle += offset;
angle = angle / 180f * (float) Math.PI;
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, state);
kineticRotationTransform(superByteBuffer, te, axis, angle, getWorld());
superByteBuffer.translate(x, y, z).renderInto(buffer);
kineticRotationTransform(shaft, te, axis, angle, getWorld());
shaft.translate(x, y, z).renderInto(buffer);
}
}

View file

@ -142,7 +142,6 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel {
setTier(c, ComponentTier.Chromatic, gunWithPurpurStuff);
items.add(gunWithPurpurStuff);
}
super.fillItemGroup(group, items);
}
@Override

View file

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.IWithTileEntity;
@ -13,6 +14,7 @@ import net.minecraft.block.FourWayBlock;
import net.minecraft.block.PaneBlock;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState;
@ -44,7 +46,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class WindowInABlockBlock extends PaneBlock
implements IWithTileEntity<WindowInABlockTileEntity>, IHaveNoBlockItem {
implements IWithTileEntity<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel {
public WindowInABlockBlock() {
super(Properties.create(Material.ROCK));
@ -217,4 +219,10 @@ public class WindowInABlockBlock extends PaneBlock
return false;
}
@Override
@OnlyIn(Dist.CLIENT)
public IBakedModel createModel(IBakedModel original) {
return new WindowInABlockModel(original);
}
}

View file

@ -2,17 +2,15 @@ package com.simibubi.create.modules.logistics.block.belts;
import com.mojang.blaze3d.platform.GLX;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.state.properties.BlockStateProperties;
public class BeltObserverTileEntityRenderer extends TileEntityRenderer<BeltObserverTileEntity> {
public class BeltObserverTileEntityRenderer extends SafeTileEntityRenderer<BeltObserverTileEntity> {
@Override
public void render(BeltObserverTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
public void renderWithGL(BeltObserverTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
int destroyStage) {
super.render(tileEntityIn, x, y, z, partialTicks, destroyStage);
int i = tileEntityIn.getWorld().getCombinedLight(tileEntityIn.getPos().up()
.offset(tileEntityIn.getBlockState().get(BlockStateProperties.HORIZONTAL_FACING)), 0);
int j = i % 65536;

View file

@ -1,10 +1,9 @@
package com.simibubi.create.modules.logistics.block.diodes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRenderer;
import com.simibubi.create.foundation.utility.ColorHelper;
import net.minecraft.block.BlockState;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRenderer<FlexpeaterTileEntity> {
@ -14,8 +13,8 @@ public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRender
}
@Override
protected BlockState getOverlayState(FlexpeaterTileEntity te) {
return AllBlocks.FLEXPEATER_INDICATOR.get().getDefaultState();
protected SuperByteBuffer getOverlayBuffer(FlexpeaterTileEntity te) {
return AllBlockPartials.FLEXPEATER_INDICATOR.renderOn(te.getBlockState());
}
}

View file

@ -28,9 +28,7 @@ public class CTGlassBlock extends GlassBlock implements IHaveConnectedTextures {
@OnlyIn(Dist.CLIENT)
@Override
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
return adjacentBlockState.getBlock() instanceof CTGlassBlock
? (!state.canRenderInLayer(BlockRenderLayer.TRANSLUCENT) && side.getAxis().isHorizontal()
|| state.getBlock() == adjacentBlockState.getBlock())
return adjacentBlockState.getBlock() instanceof CTGlassBlock ? true
: super.isSideInvisible(state, adjacentBlockState, side);
}

View file

@ -0,0 +1,26 @@
package com.simibubi.create.modules.palettes;
import com.simibubi.create.AllCTs;
import net.minecraft.block.BlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class CTWindowBlock extends VerticalCTGlassBlock {
public CTWindowBlock(AllCTs spriteShift, boolean hasAlpha) {
super(spriteShift, hasAlpha);
}
@OnlyIn(Dist.CLIENT)
@Override
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
return adjacentBlockState.getBlock() instanceof CTGlassBlock
? (!state.canRenderInLayer(BlockRenderLayer.TRANSLUCENT) && side.getAxis().isHorizontal()
|| state.getBlock() == adjacentBlockState.getBlock())
: super.isSideInvisible(state, adjacentBlockState, side);
}
}

View file

@ -3,20 +3,27 @@ package com.simibubi.create.modules.schematics.block;
import java.util.Random;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
public class SchematicannonRenderer extends TileEntityRenderer<SchematicannonTileEntity> {
public class SchematicannonRenderer extends SafeTileEntityRenderer<SchematicannonTileEntity> {
@Override
public void render(SchematicannonTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
public void renderWithGL(SchematicannonTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
int destroyStage) {
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
@ -100,38 +107,40 @@ public class SchematicannonRenderer extends TileEntityRenderer<SchematicannonTil
double sX = cannonOffset.x * .01f;
double sY = (cannonOffset.y + 1) * .01f;
double sZ = cannonOffset.z * .01f;
double rX = r.nextFloat() - sX * 40;
double rX = r.nextFloat() - sX * 40;
double rY = r.nextFloat() - sY * 40;
double rZ = r.nextFloat() - sZ * 40;
tileEntityIn.getWorld().addParticle(ParticleTypes.CLOUD, start.x + rX, start.y + rY, start.z + rZ,
sX, sY, sZ);
tileEntityIn.getWorld().addParticle(ParticleTypes.CLOUD, start.x + rX, start.y + rY,
start.z + rZ, sX, sY, sZ);
}
}
}
}
TessellatorHelper.prepareFastRender();
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
GlStateManager.pushMatrix();
GlStateManager.translated(x + .5f, y, z + 1 - .5f);
GlStateManager.rotated(yaw, 0, 1, 0);
GlStateManager.translated(-0.5f, 0, 0.5f);
Minecraft.getInstance().getBlockRendererDispatcher()
.renderBlockBrightness(AllBlocks.SCHEMATICANNON_CONNECTOR.get().getDefaultState(), 1);
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
BlockState state = tileEntityIn.getBlockState();
int lightCoords = state.getPackedLightmapCoords(getWorld(), pos);
SuperByteBuffer connector = AllBlockPartials.SCHEMATICANNON_CONNECTOR.renderOn(state);
connector.translate(-.5f, 0, -.5f);
connector.rotate(Axis.Y, (float) ((yaw + 90) / 180 * Math.PI));
connector.translate(.5f, 0, .5f);
connector.translate(x, y, z).light(lightCoords).renderInto(buffer);
SuperByteBuffer pipe = AllBlockPartials.SCHEMATICANNON_PIPE.renderOn(state);
pipe.translate(0, -recoil / 100, 0);
pipe.translate(-.5f, -15 / 16f, -.5f);
pipe.rotate(Axis.Z, (float) (pitch / 180 * Math.PI));
pipe.rotate(Axis.Y, (float) ((yaw + 90) / 180 * Math.PI));
pipe.translate(.5f, 15 / 16f, .5f);
pipe.translate(x, y, z).light(lightCoords).renderInto(buffer);
TessellatorHelper.draw();
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translated(x + .5f, y + .90f, z + 1 - .5f);
GlStateManager.rotated(yaw, 0, 1, 0);
GlStateManager.rotated(pitch, 1, 0, 0);
GlStateManager.translated(-0.5f, -.90f, 0.5f);
GlStateManager.translated(0, -recoil / 100, 0);
Minecraft.getInstance().getBlockRendererDispatcher()
.renderBlockBrightness(AllBlocks.SCHEMATICANNON_PIPE.get().getDefaultState(), 1);
GlStateManager.popMatrix();
super.render(tileEntityIn, x, y, z, partialTicks, destroyStage);
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/analog_lever/handle" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/analog_lever/indicator" }
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"axis=y": { "model": "create:block/belt_pulley" },
"axis=z": { "model": "create:block/belt_pulley", "x": 90 },
"axis=x": { "model": "create:block/belt_pulley", "x": 90, "y": 90 }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/belt_tunnel/flap" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/belt_tunnel/indicator" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/deployer/hand_holding" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/deployer/hand_pointing" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/deployer/hand_punching" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/deployer/pole" }
}
}

View file

@ -1,16 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/drill"
},
"variants": {
"facing": {
"north": { "y": 180 },
"south": { },
"west": { "y": 90 },
"up": { "x": 90 },
"down": { "x": 270 },
"east": { "y": 270 }
}
}
}

View file

@ -1,16 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/encased_fan/propeller"
},
"variants": {
"facing": {
"north": { "y": 0 },
"south": { "y": 180 },
"west": { "y": 270 },
"up": { "x": 270 },
"down": { "x": 90 },
"east": { "y": 90 }
}
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/repeaters/flexpeater_indicator" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/gauge/dial" }
}
}

View file

@ -1,6 +0,0 @@
{
"variants": {
"type=speed": { "model": "create:block/gauge/speed" },
"type=stress": { "model": "create:block/gauge/stress" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/gauge/indicator" }
}
}

View file

@ -1,16 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/hand_crank/handle"
},
"variants": {
"facing": {
"north": { "y": 0 },
"south": { "y": 180 },
"west": { "y": 270 },
"up": { "x": 270 },
"down": { "x": 90 },
"east": { "y": 90 }
}
}
}

View file

@ -1,14 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/harvester_blade"
},
"variants": {
"facing": {
"north": { "y": 180 },
"south": {},
"east": { "y": 270 },
"west": { "y": 90 }
}
}
}

View file

@ -1,16 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/mechanical_bearing_top"
},
"variants": {
"facing" : {
"up" : { },
"down" : { "x": 180 },
"north" : { "x": 90 },
"east" : { "x": 90, "y": 90 },
"south" : { "x": 90, "y": 180 },
"west" : { "x": 90, "y": 270 }
}
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/crafter/arrow" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/crafter/belt_animated" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/crafter/belt" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/crafter/lid" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/mixer_head" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/mixer_pole" }
}
}

View file

@ -1,14 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/mechanical_press_head"
},
"variants": {
"facing": {
"north": { "y": 0 },
"east": { "y": 90 },
"west": { "y": 90 },
"south": { "y": 0 }
}
}
}

View file

@ -1,6 +1,6 @@
{
"forgemarker": 1,
"variants": {
"": { "model": "create:block/schematicannon_base" }
"": { "model": "create:block/schematicannon/base" }
}
}

View file

@ -1,6 +0,0 @@
{
"forgemarker": 1,
"variants": {
"": { "model": "create:block/schematicannon_connector" }
}
}

View file

@ -1,6 +0,0 @@
{
"forgemarker": 1,
"variants": {
"": { "model": "create:block/schematicannon_pipe" }
}
}

View file

@ -1,16 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/shaft_half"
},
"variants": {
"facing" : {
"up" : { },
"down" : { "x": 180 },
"north" : { "x": 90 },
"east" : { "x": 90, "y": 90 },
"south" : { "x": 90, "y": 180 },
"west" : { "x": 90, "y": 270 }
}
}
}

View file

@ -1,13 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "create:block/cogwheel_shaftless"
},
"variants": {
"axis" : {
"x": { "x": 90, "y": 90 },
"y": {},
"z": { "x": 90 }
}
}
}

View file

@ -10,6 +10,7 @@
{
"from": [4.99, 1, 3.99],
"to": [11.01, 2, 12.01],
"shade": false,
"faces": {
"north": {"uv": [2, 10, 3, 16], "rotation": 270, "texture": "#4"},
"east": {"uv": [3, 9, 11.02, 10], "texture": "#4"},

View file

@ -1,37 +1,37 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"particle": "create:block/bearing_side",
"bearing_top": "create:block/bearing_top",
"bearing_side": "create:block/bearing_side",
"credit": "Made with Blockbench",
"textures": {
"bearing_top": "create:block/bearing_top",
"particle": "create:block/bearing_side",
"bearing_side": "create:block/bearing_side",
"brass_casing": "create:block/brass_casing"
},
"elements": [
},
"elements": [
{
"name": "Cube",
"from": [ 6, 12, 16 ],
"to": [ 10, 14, 17 ],
"faces": {
"north": { "texture": "#brass_casing", "uv": [ 3, 0, 7, 2 ] },
"east": { "texture": "#brass_casing", "uv": [ 7, 0, 8, 2 ] },
"south": { "texture": "#brass_casing", "uv": [ 6, 0, 10, 2 ] },
"west": { "texture": "#brass_casing", "uv": [ 8, 0, 9, 2 ] },
"up": { "texture": "#brass_casing", "uv": [ 6, 0, 10, 1 ] },
"down": { "texture": "#brass_casing", "uv": [ 6, 1, 10, 2 ] }
}
},
{
"name": "Top",
"from": [ 0, 12, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"north": { "texture": "#bearing_side", "uv": [ 0, 0, 16, 4 ] },
"east": { "texture": "#bearing_side", "uv": [ 0, 0, 16, 4 ] },
"south": { "texture": "#bearing_side", "uv": [ 0, 0, 16, 4 ] },
"west": { "texture": "#bearing_side", "uv": [ 0, 0, 16, 4 ] },
"up": { "texture": "#bearing_top", "uv": [ 0, 0, 16, 16 ] },
"down": { "texture": "#bearing_top", "uv": [ 0, 0, 16, 16 ] }
}
}
]
"name": "Cube",
"from": [6, 12, 16],
"to": [10, 14, 17],
"faces": {
"north": {"uv": [3, 0, 7, 2], "texture": "#brass_casing"},
"east": {"uv": [7, 0, 8, 2], "texture": "#brass_casing"},
"south": {"uv": [6, 0, 10, 2], "texture": "#brass_casing"},
"west": {"uv": [8, 0, 9, 2], "texture": "#brass_casing"},
"up": {"uv": [6, 0, 10, 1], "texture": "#brass_casing"},
"down": {"uv": [6, 1, 10, 2], "texture": "#brass_casing"}
}
},
{
"name": "Top",
"from": [0, 12, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 4], "texture": "#bearing_side"},
"east": {"uv": [0, 0, 16, 4], "texture": "#bearing_side"},
"south": {"uv": [0, 0, 16, 4], "texture": "#bearing_side"},
"west": {"uv": [0, 0, 16, 4], "texture": "#bearing_side"},
"up": {"uv": [0, 0, 16, 16], "texture": "#bearing_top"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bearing_top"}
}
}
]
}

View file

@ -0,0 +1,61 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "create:block/andesite_casing_short",
"2": "block/stonecutter_bottom",
"4": "create:block/schematicannon",
"8": "block/stone",
"particle": "block/spruce_log"
},
"elements": [
{
"name": "Cube",
"from": [-2, -0.2, 5],
"to": [18, 3, 11],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"faces": {
"north": {"uv": [0, 0, 16, 3], "texture": "#0"},
"east": {"uv": [5, 0, 11, 3], "texture": "#0"},
"south": {"uv": [0, 0, 16, 3], "texture": "#0"},
"west": {"uv": [5, 0, 11, 3], "texture": "#0"},
"up": {"uv": [0, 4, 16, 10], "texture": "#8"},
"down": {"uv": [0, 4, 16, 10], "texture": "#8"}
}
},
{
"name": "Cube",
"from": [-2, -0.1, 5],
"to": [18, 3, 11],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"faces": {
"north": {"uv": [0, 0, 16, 3], "texture": "#0"},
"east": {"uv": [5, 0, 11, 3], "texture": "#0"},
"south": {"uv": [0, 0, 16, 3], "texture": "#0"},
"west": {"uv": [5, 0, 11, 3], "texture": "#0"},
"up": {"uv": [0, 4, 16, 10], "texture": "#8"},
"down": {"uv": [0, 4, 16, 10], "texture": "#8"}
}
},
{
"name": "Cube",
"from": [2, 0, 2],
"to": [14, 7, 14],
"faces": {
"north": {"uv": [0, 0, 12, 7], "texture": "#4"},
"east": {"uv": [0, 0, 12, 7], "texture": "#4"},
"south": {"uv": [0, 0, 12, 7], "texture": "#4"},
"west": {"uv": [0, 0, 12, 7], "texture": "#4"},
"up": {"uv": [2, 2, 14, 14], "texture": "#2"},
"down": {"uv": [0, 4, 12, 16], "texture": "#8"}
}
}
],
"groups": [
{
"name": "Base",
"origin": [8, 8, 8],
"children": [0, 1, 2]
}
]
}

View file

@ -0,0 +1,55 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"5": "block/spruce_log",
"6": "block/spruce_log_top",
"particle": "block/spruce_log"
},
"elements": [
{
"name": "Cube",
"from": [3, 11, 0],
"to": [13, 20, 3],
"faces": {
"north": {"uv": [3, 3, 13, 12], "texture": "#6"},
"east": {"uv": [0, 3, 3, 12], "texture": "#6"},
"south": {"uv": [3, 2, 13, 11], "texture": "#5"},
"west": {"uv": [13, 3, 16, 12], "texture": "#6"},
"up": {"uv": [3, 0, 13, 3], "rotation": 180, "texture": "#6"}
}
},
{
"name": "Cube",
"from": [3, 11, 13],
"to": [13, 20, 16],
"faces": {
"north": {"uv": [3, 2, 13, 11], "texture": "#5"},
"east": {"uv": [3, 3, 0, 12], "texture": "#6"},
"south": {"uv": [13, 3, 3, 12], "texture": "#6"},
"west": {"uv": [16, 3, 13, 12], "texture": "#6"},
"up": {"uv": [3, 3, 13, 0], "rotation": 180, "texture": "#6"}
}
},
{
"name": "Cube",
"from": [1, 7, 0],
"to": [15, 11, 16],
"faces": {
"north": {"uv": [12, 1, 16, 15], "rotation": 90, "texture": "#6"},
"east": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#5"},
"south": {"uv": [12, 1, 16, 15], "rotation": 90, "texture": "#6"},
"west": {"uv": [8, 0, 12, 16], "rotation": 90, "texture": "#5"},
"up": {"uv": [1, 0, 15, 16], "texture": "#5"},
"down": {"uv": [1, 0, 15, 16], "texture": "#5"}
}
}
],
"groups": [
{
"name": "Connector",
"origin": [8, 8, 8],
"children": [0, 1, 2]
}
]
}

View file

@ -0,0 +1,74 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"3": "block/anvil",
"4": "create:block/schematicannon",
"particle": "block/spruce_log"
},
"elements": [
{
"name": "Cube",
"from": [4, 30, 4],
"to": [12, 32, 12],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [6, 0, 14, 2], "texture": "#3"},
"east": {"uv": [3, 0, 11, 2], "texture": "#3"},
"south": {"uv": [5, 0, 13, 2], "texture": "#3"},
"west": {"uv": [2, 0, 10, 2], "texture": "#3"},
"up": {"uv": [0, 8, 8, 16], "texture": "#4"},
"down": {"uv": [4, 4, 12, 12], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [4.5, 20, 4.5],
"to": [11.5, 31, 11.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [8, 1, 15, 12], "texture": "#3"},
"east": {"uv": [1, 1, 8, 12], "texture": "#3"},
"south": {"uv": [8, 1, 15, 12], "texture": "#3"},
"west": {"uv": [1, 1, 8, 12], "texture": "#3"},
"up": {"uv": [4, 7, 11, 14], "texture": "#3"},
"down": {"uv": [0, 0, 7, 7], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [6, 13, -1.5],
"to": [10, 17, 17.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [10, 8, 14, 12], "texture": "#3"},
"east": {"uv": [0, 0, 16, 4], "texture": "#3"},
"south": {"uv": [10, 8, 14, 12], "texture": "#3"},
"west": {"uv": [0, 8, 16, 12], "texture": "#3"},
"up": {"uv": [3, 0, 7, 16], "texture": "#3"},
"down": {"uv": [12, 0, 16, 16], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [3.5, 10, 3.5],
"to": [12.5, 20, 12.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [4, 6, 13, 16], "texture": "#3"},
"east": {"uv": [4, 6, 13, 16], "texture": "#3"},
"south": {"uv": [4, 6, 13, 16], "texture": "#3"},
"west": {"uv": [4, 6, 13, 16], "texture": "#3"},
"up": {"uv": [4, 7, 13, 16], "texture": "#3"},
"down": {"uv": [4, 7, 13, 16], "texture": "#3"}
}
}
],
"groups": [
{
"name": "Pipe",
"origin": [8.5, 14.5, 8],
"children": [0, 1, 2, 3]
}
]
}

View file

@ -1,52 +0,0 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
"0": "block/stonecutter_side",
"1": "block/stonecutter_bottom",
"2": "block/smooth_stone_slab_side",
"particle": "block/stonecutter_side"
},
"elements": [
{
"name": "Cube",
"from": [ 1.0, 0.0, 1.0 ],
"to": [ 15.0, 8.0, 15.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"east": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"south": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"west": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"up": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 15.0 ] },
"down": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }
}
},
{
"name": "Cube",
"from": [ -3.0, -0.1, 5.0 ],
"to": [ 19.0, 3.0, 11.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 5.0, 16.0, 8.0 ] },
"east": { "texture": "#2", "uv": [ 2.0, 5.0, 8.0, 8.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 13.0, 16.0, 16.0 ] },
"west": { "texture": "#2", "uv": [ 2.0, 13.0, 8.0, 16.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 6.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 10.0, 16.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ -3.0, -0.2, 5.0 ],
"to": [ 19.0, 3.0, 11.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -45.0 },
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 5.0, 16.0, 8.0 ] },
"east": { "texture": "#2", "uv": [ 2.0, 5.0, 8.0, 8.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 13.0, 16.0, 16.0 ] },
"west": { "texture": "#2", "uv": [ 2.0, 13.0, 8.0, 16.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 6.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 10.0, 16.0, 16.0 ] }
}
}
]
}

View file

@ -1,48 +0,0 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
"0": "block/spruce_log",
"1": "block/dark_oak_log_top"
},
"elements": [
{
"name": "Cube",
"from": [ 0.5, 8.0, 0.5 ],
"to": [ 15.5, 11.0, 15.5 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 1.0, 1.0, 15.0, 15.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 15.0, 15.0 ] }
}
},
{
"name": "Cube",
"from": [ 3.0, 9.0, 0.0 ],
"to": [ 14.0, 20.0, 3.0 ],
"faces": {
"north": { "texture": "#1", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"south": { "texture": "#1", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 11.0, 3.0 ] }
}
},
{
"name": "Cube",
"from": [ 3.0, 9.0, 13.0 ],
"to": [ 14.0, 20.0, 16.0 ],
"faces": {
"north": { "texture": "#1", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"south": { "texture": "#1", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 11.0, 3.0 ] }
}
}
]
}

View file

@ -1,61 +0,0 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
"0": "block/anvil_top",
"1": "block/anvil",
"2": "block/dispenser_front_vertical"
},
"elements": [
{
"name": "Cube",
"from": [ 3.4999999925494194, 12.0, 3.5000000074505806 ],
"to": [ 12.49999999254942, 19.0, 12.50000000745058 ],
"faces": {
"north": { "texture": "#0", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"east": { "texture": "#0", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"south": { "texture": "#0", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"west": { "texture": "#0", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"up": { "texture": "#0", "uv": [ 4.0, 7.0, 13.0, 16.0 ] },
"down": { "texture": "#0", "uv": [ 4.0, 7.0, 13.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ 6.499999992549419, 12.50000000745058, -1.4999999925494194 ],
"to": [ 10.49999999254942, 16.50000000745058, 17.50000000745058 ],
"faces": {
"north": { "texture": "#1", "uv": [ 10.0, 8.0, 14.0, 12.0 ] },
"east": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 4.0 ] },
"south": { "texture": "#1", "uv": [ 10.0, 8.0, 14.0, 12.0 ] },
"west": { "texture": "#1", "uv": [ 0.0, 8.0, 16.0, 12.0 ] },
"up": { "texture": "#1", "uv": [ 3.0, 0.0, 7.0, 16.0 ] },
"down": { "texture": "#1", "uv": [ 12.0, 0.0, 16.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ 4.500000007450581, 19.0, 4.500000007450581 ],
"to": [ 11.50000000745058, 30.0, 11.50000000745058 ],
"faces": {
"north": { "texture": "#1", "uv": [ 8.0, 1.0, 15.0, 12.0 ] },
"east": { "texture": "#1", "uv": [ 1.0, 1.0, 8.0, 12.0 ] },
"south": { "texture": "#1", "uv": [ 8.0, 1.0, 15.0, 12.0 ] },
"west": { "texture": "#1", "uv": [ 1.0, 1.0, 8.0, 12.0 ] },
"up": { "texture": "#1", "uv": [ 4.0, 7.0, 11.0, 14.0 ] }
}
},
{
"name": "Cube",
"from": [ 4.0, 29.0, 4.0 ],
"to": [ 12.0, 31.0, 12.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 6.0, 0.0, 14.0, 2.0 ] },
"east": { "texture": "#2", "uv": [ 3.0, 0.0, 11.0, 2.0 ] },
"south": { "texture": "#2", "uv": [ 5.0, 0.0, 13.0, 2.0 ] },
"west": { "texture": "#2", "uv": [ 2.0, 0.0, 10.0, 2.0 ] },
"up": { "texture": "#2", "uv": [ 4.0, 4.0, 12.0, 12.0 ] },
"down": { "texture": "#2", "uv": [ 4.0, 4.0, 12.0, 12.0 ] }
}
}
]
}

View file

@ -1,25 +1,25 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "create:block/axis",
"0": "create:block/axis",
"1": "create:block/axis_top"
},
"elements": [
{
"name": "Axis",
"from": [ 6.0, 8.0, 6.0 ],
"to": [ 10.0, 16.0, 10.0 ],
"textures": {
"0": "create:block/axis",
"1": "create:block/axis_top",
"particle": "create:block/axis"
},
"elements": [
{
"name": "Axis",
"from": [6, 6, 8],
"to": [10, 10, 16],
"shade": false,
"faces": {
"north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] },
"east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] },
"south": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] },
"west": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] },
"up": { "texture": "#1", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"down": { "texture": "#1", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }
}
}
]
"faces": {
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"},
"east": {"uv": [6, 0, 10, 8], "rotation": 270, "texture": "#0"},
"south": {"uv": [6, 6, 10, 10], "texture": "#1"},
"west": {"uv": [6, 0, 10, 8], "rotation": 90, "texture": "#0"},
"up": {"uv": [6, 0, 10, 8], "rotation": 180, "texture": "#0"},
"down": {"uv": [6, 0, 10, 8], "texture": "#0"}
}
}
]
}

View file

@ -1,151 +1,200 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "block/stonecutter_side",
"1": "block/stonecutter_bottom",
"2": "block/smooth_stone_slab_side",
"3": "block/spruce_log",
"4": "block/dark_oak_log_top",
"5": "block/anvil_top",
"6": "block/anvil",
"7": "block/dispenser_front_vertical"
},
"elements": [
{
"name": "Cube",
"from": [ 1.0, 0.0, 1.0 ],
"to": [ 15.0, 8.0, 15.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"east": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"south": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"west": { "texture": "#0", "uv": [ 1.0, 8.0, 15.0, 16.0 ] },
"up": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 15.0 ] },
"down": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }
}
},
{
"name": "Cube",
"from": [ -3.0, -0.1, 5.0 ],
"to": [ 19.0, 3.0, 11.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 5.0, 16.0, 8.0 ] },
"east": { "texture": "#2", "uv": [ 2.0, 5.0, 8.0, 8.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 13.0, 16.0, 16.0 ] },
"west": { "texture": "#2", "uv": [ 2.0, 13.0, 8.0, 16.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 6.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 10.0, 16.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ -3.0, -0.2, 5.0 ],
"to": [ 19.0, 3.0, 11.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -45.0 },
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 5.0, 16.0, 8.0 ] },
"east": { "texture": "#2", "uv": [ 2.0, 5.0, 8.0, 8.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 13.0, 16.0, 16.0 ] },
"west": { "texture": "#2", "uv": [ 2.0, 13.0, 8.0, 16.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 6.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 10.0, 16.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ 0.5, 8.0, 0.5 ],
"to": [ 15.5, 11.0, 15.5 ],
"faces": {
"north": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"east": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"south": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"west": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
"up": { "texture": "#3", "uv": [ 1.0, 1.0, 15.0, 15.0 ] },
"down": { "texture": "#3", "uv": [ 0.0, 0.0, 15.0, 15.0 ] }
}
},
{
"name": "Cube",
"from": [ 3.0, 9.0, 0.0 ],
"to": [ 14.0, 20.0, 3.0 ],
"faces": {
"north": { "texture": "#4", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"south": { "texture": "#4", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"up": { "texture": "#3", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },
"down": { "texture": "#3", "uv": [ 0.0, 0.0, 11.0, 3.0 ] }
}
},
{
"name": "Cube",
"from": [ 3.0, 9.0, 13.0 ],
"to": [ 14.0, 20.0, 16.0 ],
"faces": {
"north": { "texture": "#4", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"south": { "texture": "#4", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 11.0 ] },
"up": { "texture": "#3", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },
"down": { "texture": "#3", "uv": [ 0.0, 0.0, 11.0, 3.0 ] }
}
},
{
"name": "Cube",
"from": [ 3.4999999925494194, 12.0, 3.5000000074505806 ],
"to": [ 12.49999999254942, 19.0, 12.50000000745058 ],
"rotation": { "origin": [ 8.5, 14.5, 8.0 ], "axis": "z", "angle": 45.0 },
"faces": {
"north": { "texture": "#5", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"east": { "texture": "#5", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"south": { "texture": "#5", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"west": { "texture": "#5", "uv": [ 4.0, 9.0, 13.0, 16.0 ] },
"up": { "texture": "#5", "uv": [ 4.0, 7.0, 13.0, 16.0 ] },
"down": { "texture": "#5", "uv": [ 4.0, 7.0, 13.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ 6.499999992549419, 12.50000000745058, -1.4999999925494194 ],
"to": [ 10.49999999254942, 16.50000000745058, 17.50000000745058 ],
"rotation": { "origin": [ 8.50000000745058, 14.50000000745058, 8.0 ], "axis": "z", "angle": 45.0 },
"faces": {
"north": { "texture": "#6", "uv": [ 10.0, 8.0, 14.0, 12.0 ] },
"east": { "texture": "#6", "uv": [ 0.0, 0.0, 16.0, 4.0 ] },
"south": { "texture": "#6", "uv": [ 10.0, 8.0, 14.0, 12.0 ] },
"west": { "texture": "#6", "uv": [ 0.0, 8.0, 16.0, 12.0 ] },
"up": { "texture": "#6", "uv": [ 3.0, 0.0, 7.0, 16.0 ] },
"down": { "texture": "#6", "uv": [ 12.0, 0.0, 16.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ 4.500000007450581, 19.0, 4.500000007450581 ],
"to": [ 11.50000000745058, 30.0, 11.50000000745058 ],
"rotation": { "origin": [ 8.5, 14.5, 8.0 ], "axis": "z", "angle": 45.0 },
"faces": {
"north": { "texture": "#6", "uv": [ 8.0, 1.0, 15.0, 12.0 ] },
"east": { "texture": "#6", "uv": [ 1.0, 1.0, 8.0, 12.0 ] },
"south": { "texture": "#6", "uv": [ 8.0, 1.0, 15.0, 12.0 ] },
"west": { "texture": "#6", "uv": [ 1.0, 1.0, 8.0, 12.0 ] },
"up": { "texture": "#6", "uv": [ 4.0, 7.0, 11.0, 14.0 ] }
}
},
{
"name": "Cube",
"from": [ 4.0, 29.0, 4.0 ],
"to": [ 12.0, 31.0, 12.0 ],
"rotation": { "origin": [ 8.5, 14.5, 8.0 ], "axis": "z", "angle": 45.0 },
"faces": {
"north": { "texture": "#7", "uv": [ 6.0, 0.0, 14.0, 2.0 ] },
"east": { "texture": "#7", "uv": [ 3.0, 0.0, 11.0, 2.0 ] },
"south": { "texture": "#7", "uv": [ 5.0, 0.0, 13.0, 2.0 ] },
"west": { "texture": "#7", "uv": [ 2.0, 0.0, 10.0, 2.0 ] },
"up": { "texture": "#7", "uv": [ 4.0, 4.0, 12.0, 12.0 ] },
"down": { "texture": "#7", "uv": [ 4.0, 4.0, 12.0, 12.0 ] }
}
}
]
"textures": {
"0": "create:block/andesite_casing_short",
"2": "block/stonecutter_bottom",
"3": "block/anvil",
"4": "create:block/schematicannon",
"5": "block/spruce_log",
"6": "block/spruce_log_top",
"8": "block/stone",
"particle": "block/spruce_log"
},
"elements": [
{
"name": "Cube",
"from": [4, 30, 4],
"to": [12, 32, 12],
"rotation": {"angle": 45, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [6, 0, 14, 2], "texture": "#3"},
"east": {"uv": [3, 0, 11, 2], "texture": "#3"},
"south": {"uv": [5, 0, 13, 2], "texture": "#3"},
"west": {"uv": [2, 0, 10, 2], "texture": "#3"},
"up": {"uv": [0, 8, 8, 16], "texture": "#4"},
"down": {"uv": [4, 4, 12, 12], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [4.5, 20, 4.5],
"to": [11.5, 31, 11.5],
"rotation": {"angle": 45, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [8, 1, 15, 12], "texture": "#3"},
"east": {"uv": [1, 1, 8, 12], "texture": "#3"},
"south": {"uv": [8, 1, 15, 12], "texture": "#3"},
"west": {"uv": [1, 1, 8, 12], "texture": "#3"},
"up": {"uv": [4, 7, 11, 14], "texture": "#3"},
"down": {"uv": [0, 0, 7, 7], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [6, 13, -1.5],
"to": [10, 17, 17.5],
"rotation": {"angle": 45, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [10, 8, 14, 12], "texture": "#3"},
"east": {"uv": [0, 0, 16, 4], "texture": "#3"},
"south": {"uv": [10, 8, 14, 12], "texture": "#3"},
"west": {"uv": [0, 8, 16, 12], "texture": "#3"},
"up": {"uv": [3, 0, 7, 16], "texture": "#3"},
"down": {"uv": [12, 0, 16, 16], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [3.5, 10, 3.5],
"to": [12.5, 20, 12.5],
"rotation": {"angle": 45, "axis": "z", "origin": [8, 15, 0]},
"faces": {
"north": {"uv": [4, 6, 13, 16], "texture": "#3"},
"east": {"uv": [4, 6, 13, 16], "texture": "#3"},
"south": {"uv": [4, 6, 13, 16], "texture": "#3"},
"west": {"uv": [4, 6, 13, 16], "texture": "#3"},
"up": {"uv": [4, 7, 13, 16], "texture": "#3"},
"down": {"uv": [4, 7, 13, 16], "texture": "#3"}
}
},
{
"name": "Cube",
"from": [3, 11, 0],
"to": [13, 20, 3],
"faces": {
"north": {"uv": [3, 3, 13, 12], "texture": "#6"},
"east": {"uv": [0, 3, 3, 12], "texture": "#6"},
"south": {"uv": [3, 2, 13, 11], "texture": "#5"},
"west": {"uv": [13, 3, 16, 12], "texture": "#6"},
"up": {"uv": [3, 0, 13, 3], "rotation": 180, "texture": "#6"}
}
},
{
"name": "Cube",
"from": [3, 11, 13],
"to": [13, 20, 16],
"faces": {
"north": {"uv": [3, 2, 13, 11], "texture": "#5"},
"east": {"uv": [3, 3, 0, 12], "texture": "#6"},
"south": {"uv": [13, 3, 3, 12], "texture": "#6"},
"west": {"uv": [16, 3, 13, 12], "texture": "#6"},
"up": {"uv": [3, 3, 13, 0], "rotation": 180, "texture": "#6"}
}
},
{
"name": "Cube",
"from": [1, 7, 0],
"to": [15, 11, 16],
"faces": {
"north": {"uv": [12, 1, 16, 15], "rotation": 90, "texture": "#6"},
"east": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#5"},
"south": {"uv": [12, 1, 16, 15], "rotation": 90, "texture": "#6"},
"west": {"uv": [8, 0, 12, 16], "rotation": 90, "texture": "#5"},
"up": {"uv": [1, 0, 15, 16], "texture": "#5"},
"down": {"uv": [1, 0, 15, 16], "texture": "#5"}
}
},
{
"name": "Cube",
"from": [-2, -0.2, 5],
"to": [18, 3, 11],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"faces": {
"north": {"uv": [0, 0, 16, 3], "texture": "#0"},
"east": {"uv": [5, 0, 11, 3], "texture": "#0"},
"south": {"uv": [0, 0, 16, 3], "texture": "#0"},
"west": {"uv": [5, 0, 11, 3], "texture": "#0"},
"up": {"uv": [0, 4, 16, 10], "texture": "#8"},
"down": {"uv": [0, 4, 16, 10], "texture": "#8"}
}
},
{
"name": "Cube",
"from": [-2, -0.1, 5],
"to": [18, 3, 11],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"faces": {
"north": {"uv": [0, 0, 16, 3], "texture": "#0"},
"east": {"uv": [5, 0, 11, 3], "texture": "#0"},
"south": {"uv": [0, 0, 16, 3], "texture": "#0"},
"west": {"uv": [5, 0, 11, 3], "texture": "#0"},
"up": {"uv": [0, 4, 16, 10], "texture": "#8"},
"down": {"uv": [0, 4, 16, 10], "texture": "#8"}
}
},
{
"name": "Cube",
"from": [2, 0, 2],
"to": [14, 7, 14],
"faces": {
"north": {"uv": [0, 0, 12, 7], "texture": "#4"},
"east": {"uv": [0, 0, 12, 7], "texture": "#4"},
"south": {"uv": [0, 0, 12, 7], "texture": "#4"},
"west": {"uv": [0, 0, 12, 7], "texture": "#4"},
"up": {"uv": [2, 2, 14, 14], "texture": "#2"},
"down": {"uv": [0, 4, 12, 16], "texture": "#8"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, -47, 0],
"translation": [0, 2.5, 1.5],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, -47, 0],
"translation": [0, 2.5, 1.5],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, -69, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 97, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 135, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": {
"rotation": [0, -90, 0],
"translation": [0, -1.5, 0],
"scale": [0.5, 0.5, 0.5]
}
},
"groups": [
{
"name": "Pipe",
"origin": [8.5, 14.5, 8],
"children": [0, 1, 2, 3]
},
{
"name": "Connector",
"origin": [8, 8, 8],
"children": [4, 5, 6]
},
{
"name": "Base",
"origin": [8, 8, 8],
"children": [7, 8, 9]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B