mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 06:24:12 +01:00
More porting work
This commit is contained in:
parent
7e5406eb05
commit
844dc42501
@ -60,10 +60,11 @@ public enum AllEntities {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") // TODO 1.15 this generic stuff is incompatible with the enum system - need strong types
|
||||||
@OnlyIn(value = Dist.CLIENT)
|
@OnlyIn(value = Dist.CLIENT)
|
||||||
public static void registerRenderers() {
|
public static void registerRenderers() {
|
||||||
// RenderingRegistry.registerEntityRenderingHandler(CardboardBoxEntity.class, CardboardBoxEntityRenderer::new);
|
// RenderingRegistry.registerEntityRenderingHandler(CardboardBoxEntity.class, CardboardBoxEntityRenderer::new);
|
||||||
RenderingRegistry.registerEntityRenderingHandler(ContraptionEntity.class, ContraptionEntityRenderer::new);
|
RenderingRegistry.registerEntityRenderingHandler((EntityType<ContraptionEntity>) CONTRAPTION.type, ContraptionEntityRenderer::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public enum AllItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Properties defaultProperties(AllItems item) {
|
private static Properties defaultProperties(AllItems item) {
|
||||||
return includeInItemGroup().setTEISR(() -> item::getRenderer);
|
return includeInItemGroup().setISTER(() -> item::getRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int module() {
|
private static int module() {
|
||||||
|
@ -54,7 +54,7 @@ public enum AllKeys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isKeyDown(int key) {
|
public static boolean isKeyDown(int key) {
|
||||||
return GLFW.glfwGetKey(Minecraft.getInstance().mainWindow.getHandle(), key) != 0;
|
return GLFW.glfwGetKey(Minecraft.getInstance().getWindow().getHandle(), key) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean ctrlDown() {
|
public static boolean ctrlDown() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer;
|
import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer;
|
||||||
@ -88,6 +89,7 @@ import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@ -190,61 +192,62 @@ public enum AllTileEntities {
|
|||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void registerRenderers() {
|
public static void registerRenderers() {
|
||||||
bind(SchematicannonTileEntity.class, new SchematicannonRenderer());
|
bind(SCHEMATICANNON, SchematicannonRenderer::new);
|
||||||
|
|
||||||
bind(ShaftTileEntity.class, new KineticTileEntityRenderer());
|
bind(SHAFT, KineticTileEntityRenderer::new);
|
||||||
bind(TurntableTileEntity.class, new KineticTileEntityRenderer());
|
bind(TURNTABLE, KineticTileEntityRenderer::new);
|
||||||
bind(MotorTileEntity.class, new MotorTileEntityRenderer());
|
bind(MOTOR, MotorTileEntityRenderer::new);
|
||||||
bind(EncasedShaftTileEntity.class, new EncasedShaftTileEntityRenderer());
|
bind(ENCASED_SHAFT, EncasedShaftTileEntityRenderer::new);
|
||||||
bind(AdjustablePulleyTileEntity.class, new EncasedShaftTileEntityRenderer());
|
bind(ADJUSTABLE_PULLEY, EncasedShaftTileEntityRenderer::new);
|
||||||
bind(DrillTileEntity.class, new DrillTileEntityRenderer());
|
bind(DRILL, DrillTileEntityRenderer::new);
|
||||||
bind(SawTileEntity.class, new SawTileEntityRenderer());
|
bind(SAW, SawTileEntityRenderer::new);
|
||||||
bind(EncasedFanTileEntity.class, new EncasedFanTileEntityRenderer());
|
bind(ENCASED_FAN, EncasedFanTileEntityRenderer::new);
|
||||||
bind(GearboxTileEntity.class, new GearboxTileEntityRenderer());
|
bind(GEARBOX, GearboxTileEntityRenderer::new);
|
||||||
bind(GearshiftTileEntity.class, new SplitShaftTileEntityRenderer());
|
bind(GEARSHIFT, SplitShaftTileEntityRenderer::new);
|
||||||
bind(ClutchTileEntity.class, new SplitShaftTileEntityRenderer());
|
bind(CLUTCH, SplitShaftTileEntityRenderer::new);
|
||||||
bind(SequencedGearshiftTileEntity.class, new SplitShaftTileEntityRenderer());
|
bind(SEQUENCED_GEARSHIFT, SplitShaftTileEntityRenderer::new);
|
||||||
bind(BeltTileEntity.class, new BeltTileEntityRenderer());
|
bind(BELT, BeltTileEntityRenderer::new);
|
||||||
bind(WaterWheelTileEntity.class, new KineticTileEntityRenderer());
|
bind(WATER_WHEEL, KineticTileEntityRenderer::new);
|
||||||
bind(HandCrankTileEntity.class, new HandCrankTileEntityRenderer());
|
bind(HAND_CRANK, HandCrankTileEntityRenderer::new);
|
||||||
bind(CuckooClockTileEntity.class, new CuckooClockRenderer());
|
bind(CUCKOO_CLOCK, CuckooClockRenderer::new);
|
||||||
bind(AnalogLeverTileEntity.class, new AnalogLeverTileEntityRenderer());
|
bind(ANALOG_LEVER, AnalogLeverTileEntityRenderer::new);
|
||||||
|
|
||||||
bind(MechanicalPistonTileEntity.class, new MechanicalPistonTileEntityRenderer());
|
bind(MECHANICAL_PISTON, MechanicalPistonTileEntityRenderer::new);
|
||||||
bind(MechanicalBearingTileEntity.class, new BearingTileEntityRenderer());
|
bind(MECHANICAL_BEARING, BearingTileEntityRenderer::new);
|
||||||
bind(ClockworkBearingTileEntity.class, new BearingTileEntityRenderer());
|
bind(CLOCKWORK_BEARING, BearingTileEntityRenderer::new);
|
||||||
bind(PulleyTileEntity.class, new PulleyRenderer());
|
bind(ROPE_PULLEY, PulleyRenderer::new);
|
||||||
bind(HarvesterTileEntity.class, new HarvesterTileEntityRenderer());
|
bind(HARVESTER, HarvesterTileEntityRenderer::new);
|
||||||
|
|
||||||
bind(CrushingWheelTileEntity.class, new KineticTileEntityRenderer());
|
bind(CRUSHING_WHEEL, KineticTileEntityRenderer::new);
|
||||||
bind(MechanicalPressTileEntity.class, new MechanicalPressTileEntityRenderer());
|
bind(MECHANICAL_PRESS, MechanicalPressTileEntityRenderer::new);
|
||||||
bind(MechanicalMixerTileEntity.class, new MechanicalMixerTileEntityRenderer());
|
bind(MECHANICAL_MIXER, MechanicalMixerTileEntityRenderer::new);
|
||||||
bind(MechanicalCrafterTileEntity.class, new MechanicalCrafterTileEntityRenderer());
|
bind(MECHANICAL_CRAFTER, MechanicalCrafterTileEntityRenderer::new);
|
||||||
bind(SpeedGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.SPEED));
|
bind(SPEED_GAUGE, disp -> new GaugeTileEntityRenderer(disp, GaugeBlock.Type.SPEED));
|
||||||
bind(StressGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.STRESS));
|
bind(STRESS_GAUGE, disp -> new GaugeTileEntityRenderer(disp, GaugeBlock.Type.STRESS));
|
||||||
bind(BasinTileEntity.class, new BasinTileEntityRenderer());
|
bind(BASIN, BasinTileEntityRenderer::new);
|
||||||
bind(DeployerTileEntity.class, new DeployerTileEntityRenderer());
|
bind(DEPLOYER, DeployerTileEntityRenderer::new);
|
||||||
bind(FlywheelTileEntity.class, new FlywheelRenderer());
|
bind(FLYWHEEL, FlywheelRenderer::new);
|
||||||
bind(FurnaceEngineTileEntity.class, new EngineRenderer<>());
|
bind(FURNACE_ENGINE, EngineRenderer::new);
|
||||||
bind(SpeedControllerTileEntity.class, new SpeedControllerRenderer());
|
bind(ROTATION_SPEED_CONTROLLER, SpeedControllerRenderer::new);
|
||||||
|
|
||||||
bind(RedstoneLinkTileEntity.class, new SmartTileEntityRenderer<>());
|
bind(REDSTONE_BRIDGE, SmartTileEntityRenderer::new);
|
||||||
bind(ExtractorTileEntity.class, new SmartTileEntityRenderer<>());
|
bind(EXTRACTOR, SmartTileEntityRenderer::new);
|
||||||
bind(LinkedExtractorTileEntity.class, new SmartTileEntityRenderer<>());
|
bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new);
|
||||||
bind(TransposerTileEntity.class, new SmartTileEntityRenderer<>());
|
bind(TRANSPOSER, SmartTileEntityRenderer::new);
|
||||||
bind(LinkedTransposerTileEntity.class, new SmartTileEntityRenderer<>());
|
bind(LINKED_TRANSPOSER, SmartTileEntityRenderer::new);
|
||||||
bind(FunnelTileEntity.class, new SmartTileEntityRenderer<>());
|
bind(BELT_FUNNEL, SmartTileEntityRenderer::new);
|
||||||
bind(BeltTunnelTileEntity.class, new BeltTunnelTileEntityRenderer());
|
bind(BELT_TUNNEL, BeltTunnelTileEntityRenderer::new);
|
||||||
bind(BeltObserverTileEntity.class, new BeltObserverTileEntityRenderer());
|
bind(ENTITY_DETECTOR, BeltObserverTileEntityRenderer::new);
|
||||||
bind(FlexpeaterTileEntity.class, new FlexpeaterTileEntityRenderer());
|
bind(FLEXPEATER, FlexpeaterTileEntityRenderer::new);
|
||||||
|
|
||||||
// bind(LogisticalControllerTileEntity.class, new LogisticalControllerTileEntityRenderer());
|
// bind(LogisticalController, LogisticalControllerTileEntityRenderer::new);
|
||||||
// bind(LogisticiansTableTileEntity.class, new LogisticiansTableTileEntityRenderer());
|
// bind(LogisticiansTable, LogisticiansTableTileEntityRenderer::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") // TODO 1.15 this generic stuff is incompatible with the enum system - need strong types
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private static <T extends TileEntity> void bind(Class<T> clazz, TileEntityRenderer<? super T> renderer) {
|
private static <T extends TileEntity> void bind(AllTileEntities type, Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<?>> renderer) {
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(clazz, renderer);
|
ClientRegistry.bindTileEntityRenderer((TileEntityType<T>) type.type, (Function<TileEntityRendererDispatcher, TileEntityRenderer<T>>) renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.renderer.BlockModelShapes;
|
import net.minecraft.client.renderer.BlockModelShapes;
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
import net.minecraft.resources.IReloadableResourceManager;
|
import net.minecraft.resources.IReloadableResourceManager;
|
||||||
import net.minecraft.resources.IResourceManager;
|
import net.minecraft.resources.IResourceManager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@ -87,7 +88,7 @@ public class CreateClient {
|
|||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
||||||
if (!event.getMap().getBasePath().equals("textures"))
|
if (!event.getMap().getId().equals(AtlasTexture.LOCATION_BLOCKS_TEXTURE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.addSprite(new ResourceLocation(Create.ID, "block/belt_animated"));
|
event.addSprite(new ResourceLocation(Create.ID, "block/belt_animated"));
|
||||||
|
@ -60,7 +60,7 @@ public final class CreateItemGroup extends ItemGroup {
|
|||||||
continue;
|
continue;
|
||||||
if (!item.module.isEnabled())
|
if (!item.module.isEnabled())
|
||||||
continue;
|
continue;
|
||||||
IBakedModel model = itemRenderer.getModelWithOverrides(item.asStack());
|
IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, Minecraft.getInstance().player);
|
||||||
if (model.isGui3d() != specialItems)
|
if (model.isGui3d() != specialItems)
|
||||||
continue;
|
continue;
|
||||||
if (item.get() instanceof IAddedByOther)
|
if (item.get() instanceof IAddedByOther)
|
||||||
|
@ -38,7 +38,7 @@ public class DoubleItemIcon implements IDrawable {
|
|||||||
secondaryStack = secondarySupplier.get();
|
secondaryStack = secondarySupplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enable();
|
||||||
RenderSystem.color4f(1, 1, 1, 1);
|
RenderSystem.color4f(1, 1, 1, 1);
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
|
@ -55,14 +55,14 @@ public class BlastingViaFanCategory extends ProcessingViaFanCategory<AbstractCoo
|
|||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translated(0, 200, 0);
|
RenderSystem.translated(0, 200, 0);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
ScreenElementRenderer.renderBlock(() -> state);
|
ScreenElementRenderer.renderBlock(() -> state);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translated(0, 200, 0);
|
RenderSystem.translated(0, 200, 0);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
RenderSystem.rotated(270, 0, 0, 1);
|
RenderSystem.rotatef(270, 0, 0, 1);
|
||||||
ScreenElementRenderer.renderBlock(() -> state);
|
ScreenElementRenderer.renderBlock(() -> state);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> implements
|
|||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
|
|
||||||
RenderSystem.translated(28, 18, 0);
|
RenderSystem.translated(28, 18, 0);
|
||||||
RenderSystem.rotated(10.5, -1f, 0, 0);
|
RenderSystem.rotatef(10.5f, -1f, 0, 0);
|
||||||
RenderSystem.rotated(15.5, 0, 1, 0);
|
RenderSystem.rotatef(15.5f, 0, 1, 0);
|
||||||
RenderSystem.scaled(.6f, .6f, .6f);
|
RenderSystem.scaled(.6f, .6f, .6f);
|
||||||
ScreenElementRenderer.renderBlock(this::renderFanCasing);
|
ScreenElementRenderer.renderBlock(this::renderFanCasing);
|
||||||
|
|
||||||
@ -73,18 +73,18 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> implements
|
|||||||
float angle = AnimatedKinetics.getCurrentAngle() * 12;
|
float angle = AnimatedKinetics.getCurrentAngle() * 12;
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, t);
|
RenderSystem.translatef(t, -t, t);
|
||||||
RenderSystem.rotated(angle, 0, 0, 1);
|
RenderSystem.rotatef(angle, 0, 0, 1);
|
||||||
RenderSystem.translatef(-t, t, -t);
|
RenderSystem.translatef(-t, t, -t);
|
||||||
|
|
||||||
RenderSystem.translatef(t, 0, 175);
|
RenderSystem.translatef(t, 0, 175);
|
||||||
RenderSystem.rotated(90, 0, 1, 0);
|
RenderSystem.rotatef(90, 0, 1, 0);
|
||||||
RenderSystem.translatef(-t, 0, -175);
|
RenderSystem.translatef(-t, 0, -175);
|
||||||
|
|
||||||
ScreenElementRenderer.renderModel(this::renderFanInner);
|
ScreenElementRenderer.renderModel(this::renderFanInner);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
RenderSystem.translated(-10, 0, 95);
|
RenderSystem.translated(-10, 0, 95);
|
||||||
RenderSystem.rotated(7, 0, 1, 0);
|
RenderSystem.rotatef(7, 0, 1, 0);
|
||||||
renderAttachedBlock();
|
renderAttachedBlock();
|
||||||
|
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
@ -116,14 +116,14 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
|
|||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translated(0, 200, 0);
|
RenderSystem.translated(0, 200, 0);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
ScreenElementRenderer.renderBlock(() -> state);
|
ScreenElementRenderer.renderBlock(() -> state);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translated(0, 200, 0);
|
RenderSystem.translated(0, 200, 0);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
RenderSystem.rotated(270, 0, 0, 1);
|
RenderSystem.rotatef(270, 0, 0, 1);
|
||||||
ScreenElementRenderer.renderBlock(() -> state);
|
ScreenElementRenderer.renderBlock(() -> state);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ public class AnimatedCrafter extends AnimatedKinetics {
|
|||||||
private IBakedModel cogwheel(boolean forward) {
|
private IBakedModel cogwheel(boolean forward) {
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, -t);
|
RenderSystem.translatef(t, -t, -t);
|
||||||
RenderSystem.rotated(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1);
|
RenderSystem.rotatef(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
RenderSystem.translatef(-t, t, t);
|
RenderSystem.translatef(-t, t, t);
|
||||||
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
|
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
|
|||||||
|
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, t);
|
RenderSystem.translatef(t, -t, t);
|
||||||
RenderSystem.rotated(angle, 0, 0, 1);
|
RenderSystem.rotatef(angle, 0, 0, 1);
|
||||||
RenderSystem.translatef(-t, t, -t);
|
RenderSystem.translatef(-t, t, -t);
|
||||||
|
|
||||||
return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
||||||
@ -49,7 +49,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
|
|||||||
|
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, t);
|
RenderSystem.translatef(t, -t, t);
|
||||||
RenderSystem.rotated(angle, 0, 0, 1);
|
RenderSystem.rotatef(angle, 0, 0, 1);
|
||||||
RenderSystem.translatef(-t, t, -t);
|
RenderSystem.translatef(-t, t, -t);
|
||||||
|
|
||||||
return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
||||||
|
@ -56,7 +56,7 @@ public class AnimatedMixer extends AnimatedKinetics {
|
|||||||
private IBakedModel cogwheel() {
|
private IBakedModel cogwheel() {
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, -t);
|
RenderSystem.translatef(t, -t, -t);
|
||||||
RenderSystem.rotated(getCurrentAngle() * 2, 0, 1, 0);
|
RenderSystem.rotatef(getCurrentAngle() * 2, 0, 1, 0);
|
||||||
RenderSystem.translatef(-t, t, t);
|
RenderSystem.translatef(-t, t, t);
|
||||||
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
|
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ public class AnimatedMixer extends AnimatedKinetics {
|
|||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(0, 51, 0);
|
RenderSystem.translatef(0, 51, 0);
|
||||||
RenderSystem.translatef(t, -t, -t);
|
RenderSystem.translatef(t, -t, -t);
|
||||||
RenderSystem.rotated(getCurrentAngle() * 4, 0, 1, 0);
|
RenderSystem.rotatef(getCurrentAngle() * 4, 0, 1, 0);
|
||||||
RenderSystem.translatef(-t, t, t);
|
RenderSystem.translatef(-t, t, t);
|
||||||
return AllBlockPartials.MECHANICAL_MIXER_HEAD.get();
|
return AllBlockPartials.MECHANICAL_MIXER_HEAD.get();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class AnimatedPress extends AnimatedKinetics {
|
|||||||
private BlockState shaft() {
|
private BlockState shaft() {
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, -t);
|
RenderSystem.translatef(t, -t, -t);
|
||||||
RenderSystem.rotated(getCurrentAngle() * 2, 1, 0, 0);
|
RenderSystem.rotatef(getCurrentAngle() * 2, 1, 0, 0);
|
||||||
RenderSystem.translatef(-t, t, t);
|
RenderSystem.translatef(-t, t, t);
|
||||||
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Z);
|
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Z);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class AnimatedSaw extends AnimatedKinetics {
|
|||||||
private BlockState shaft() {
|
private BlockState shaft() {
|
||||||
float t = 25;
|
float t = 25;
|
||||||
RenderSystem.translatef(t, -t, t);
|
RenderSystem.translatef(t, -t, t);
|
||||||
RenderSystem.rotated(-getCurrentAngle() * 2, 0, 0, 1);
|
RenderSystem.rotatef(-getCurrentAngle() * 2, 0, 0, 1);
|
||||||
RenderSystem.translatef(-t, t, -t);
|
RenderSystem.translatef(-t, t, -t);
|
||||||
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class ValueBox {
|
|||||||
RenderSystem.translated(-7 - font.getStringWidth(countString), 10, 10 + 1 / 4f);
|
RenderSystem.translated(-7 - font.getStringWidth(countString), 10, 10 + 1 / 4f);
|
||||||
|
|
||||||
double scale = 1.5;
|
double scale = 1.5;
|
||||||
RenderSystem.rotated(0, 1, 0, 0);
|
RenderSystem.rotatef(0, 1, 0, 0);
|
||||||
RenderSystem.scaled(scale, scale, scale);
|
RenderSystem.scaled(scale, scale, scale);
|
||||||
font.drawString(countString, 0, 0, isFilter ? 0xFFFFFF : 0xEDEDED);
|
font.drawString(countString, 0, 0, isFilter ? 0xFFFFFF : 0xEDEDED);
|
||||||
RenderSystem.translated(0, 0, -1 / 16f);
|
RenderSystem.translated(0, 0, -1 / 16f);
|
||||||
|
@ -4,8 +4,14 @@ import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
|
|||||||
import com.simibubi.create.foundation.behaviour.linked.LinkRenderer;
|
import com.simibubi.create.foundation.behaviour.linked.LinkRenderer;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
|
||||||
public class SmartTileEntityRenderer<T extends SmartTileEntity> extends SafeTileEntityRenderer<T> {
|
public class SmartTileEntityRenderer<T extends SmartTileEntity> extends SafeTileEntityRenderer<T> {
|
||||||
|
|
||||||
|
public SmartTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
|
public void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||||
FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage);
|
FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage);
|
||||||
|
@ -88,7 +88,7 @@ public class ScreenElementRenderer {
|
|||||||
if (fire) {
|
if (fire) {
|
||||||
blockRenderer.renderBlockBrightness(blockToRender, 1);
|
blockRenderer.renderBlockBrightness(blockToRender, 1);
|
||||||
} else {
|
} else {
|
||||||
RenderSystem.rotated(90, 0, 1, 0);
|
RenderSystem.rotatef(90, 0, 1, 0);
|
||||||
if (color == -1) {
|
if (color == -1) {
|
||||||
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1);
|
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.simibubi.create.modules.contraptions;
|
package com.simibubi.create.modules.contraptions;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
|
||||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -17,7 +19,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public class KineticDebugger {
|
public class KineticDebugger {
|
||||||
|
|
||||||
public static void renderSourceOutline() {
|
public static void renderSourceOutline(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||||
if (!isActive())
|
if (!isActive())
|
||||||
return;
|
return;
|
||||||
KineticTileEntity te = getSelectedTE();
|
KineticTileEntity te = getSelectedTE();
|
||||||
@ -28,20 +30,16 @@ public class KineticDebugger {
|
|||||||
BlockPos toOutline = te.hasSource() ? te.source : te.getPos();
|
BlockPos toOutline = te.hasSource() ? te.source : te.getPos();
|
||||||
VoxelShape shape = world.getBlockState(toOutline).getShape(world, toOutline);
|
VoxelShape shape = world.getBlockState(toOutline).getShape(world, toOutline);
|
||||||
|
|
||||||
TessellatorHelper.prepareForDrawing();
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getLines());
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.lineWidth(3);
|
ms.push();
|
||||||
RenderSystem.pushMatrix();
|
ms.translate(toOutline.getX(), toOutline.getY(), toOutline.getZ());
|
||||||
RenderSystem.translated(toOutline.getX(), toOutline.getY(), toOutline.getZ());
|
|
||||||
float f = 1 + 1 / 128f;
|
float f = 1 + 1 / 128f;
|
||||||
RenderSystem.scaled(f, f, f);
|
ms.scale(f, f, f);
|
||||||
|
|
||||||
WorldRenderer.drawShape(shape, 0, 0, 0, te.hasSource() ? .5f : 1, .75f, .75f, 1);
|
WorldRenderer.func_228431_a_(ms, vb, shape, 0, 0, 0, te.hasSource() ? .5f : 1, .75f, .75f, 1);
|
||||||
|
|
||||||
RenderSystem.popMatrix();
|
ms.pop();
|
||||||
RenderSystem.lineWidth(1);
|
|
||||||
RenderSystem.enableTexture();
|
|
||||||
TessellatorHelper.cleanUpAfterDrawing();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isActive() {
|
public static boolean isActive() {
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.simibubi.create.modules.contraptions;
|
package com.simibubi.create.modules.contraptions;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.ItemRenderer;
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -11,22 +13,22 @@ import net.minecraft.item.ItemStack;
|
|||||||
public class WrenchItemRenderer extends ItemStackTileEntityRenderer {
|
public class WrenchItemRenderer extends ItemStackTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderByItem(ItemStack stack) {
|
public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||||
|
|
||||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||||
WrenchModel mainModel = (WrenchModel) itemRenderer.getModelWithOverrides(stack);
|
WrenchModel mainModel = (WrenchModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, Minecraft.getInstance().player);
|
||||||
float worldTime = AnimationTickHolder.getRenderTick();
|
float worldTime = AnimationTickHolder.getRenderTick();
|
||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
itemRenderer.renderItem(stack, mainModel.getBakedModel()); // TODO 1.15 what transform type is this?
|
||||||
|
|
||||||
float angle = worldTime * -.5f % 360;
|
float angle = worldTime * -.5f % 360;
|
||||||
|
|
||||||
float xOffset = -1/32f;
|
float xOffset = -1/32f;
|
||||||
float zOffset = 0;
|
float zOffset = 0;
|
||||||
RenderSystem.translatef(-xOffset, 0, -zOffset);
|
RenderSystem.translatef(-xOffset, 0, -zOffset);
|
||||||
RenderSystem.rotated(angle, 0, 1, 0);
|
RenderSystem.rotatef(angle, 0, 1, 0);
|
||||||
RenderSystem.translatef(xOffset, 0, zOffset);
|
RenderSystem.translatef(xOffset, 0, zOffset);
|
||||||
|
|
||||||
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
|
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
|
||||||
|
@ -96,9 +96,9 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
|
|||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translated(x, y, z);
|
RenderSystem.translated(x, y, z);
|
||||||
RenderSystem.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z);
|
RenderSystem.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z);
|
||||||
RenderSystem.rotated(degPitch, 0, 0, 1);
|
RenderSystem.rotatef(degPitch, 0, 0, 1);
|
||||||
RenderSystem.rotated(degYaw, 0, 1, 0);
|
RenderSystem.rotatef(degYaw, 0, 1, 0);
|
||||||
RenderSystem.rotated(degRoll, 1, 0, 0);
|
RenderSystem.rotatef(degRoll, 1, 0, 0);
|
||||||
RenderSystem.translated(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z);
|
RenderSystem.translated(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z);
|
||||||
ContraptionRenderer.renderTEsWithGL(entity.world, entity.getContraption(), entity.getPositionVec(),
|
ContraptionRenderer.renderTEsWithGL(entity.world, entity.getContraption(), entity.getPositionVec(),
|
||||||
new Vec3d(degRoll, degYaw, degPitch), ms, buffers);
|
new Vec3d(degRoll, degYaw, degPitch), ms, buffers);
|
||||||
|
@ -93,7 +93,7 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||||||
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
||||||
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
||||||
|
|
||||||
// RenderSystem.rotated(lateProgress * 360, 0, 0, 1);
|
// RenderSystem.rotatef(lateProgress * 360, 0, 0, 1);
|
||||||
ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
||||||
|
|
||||||
Vec3d centering = new Vec3d(-items.minX + (-items.width + 1) / 2f,
|
Vec3d centering = new Vec3d(-items.minX + (-items.width + 1) / 2f,
|
||||||
|
@ -47,7 +47,7 @@ public class HandCrankBlock extends DirectionalKineticBlock implements IWithTile
|
|||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
Direction preferred = getPreferredFacing(context);
|
Direction preferred = getPreferredFacing(context);
|
||||||
if (preferred == null || context.isPlacerSneaking())
|
if (preferred == null || context.getPlayer().isSneaking())
|
||||||
return getDefaultState().with(FACING, context.getFace());
|
return getDefaultState().with(FACING, context.getFace());
|
||||||
return getDefaultState().with(FACING, preferred.getOpposite());
|
return getDefaultState().with(FACING, preferred.getOpposite());
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import net.minecraft.client.renderer.BufferBuilder;
|
|||||||
import net.minecraft.client.renderer.ItemRenderer;
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@ -44,6 +45,10 @@ import net.minecraft.world.World;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerTileEntity> {
|
public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerTileEntity> {
|
||||||
|
|
||||||
|
public DeployerTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(DeployerTileEntity te, double x, double y, double z, float partialTicks,
|
public void renderWithGL(DeployerTileEntity te, double x, double y, double z, float partialTicks,
|
||||||
int destroyStage) {
|
int destroyStage) {
|
||||||
|
@ -45,7 +45,7 @@ public class EncasedFanBlock extends DirectionalKineticBlock implements IWithTil
|
|||||||
if (preferredFacing == null)
|
if (preferredFacing == null)
|
||||||
preferredFacing = context.getNearestLookingDirection();
|
preferredFacing = context.getNearestLookingDirection();
|
||||||
return getDefaultState().with(FACING,
|
return getDefaultState().with(FACING,
|
||||||
context.isPlacerSneaking() ? preferredFacing : preferredFacing.getOpposite());
|
context.getPlayer().isSneaking() ? preferredFacing : preferredFacing.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void blockUpdate(BlockState state, World worldIn, BlockPos pos) {
|
protected void blockUpdate(BlockState state, World worldIn, BlockPos pos) {
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
package com.simibubi.create.modules.contraptions.components.flywheel.engine;
|
package com.simibubi.create.modules.contraptions.components.flywheel.engine;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
|
||||||
public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRendererFast<T> {
|
public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRenderer<T> {
|
||||||
|
|
||||||
|
public EngineRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
|
protected void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||||
|
@ -12,11 +12,16 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer {
|
public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
|
public MechanicalMixerTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
@ -34,7 +34,7 @@ public class MotorBlock extends HorizontalKineticBlock {
|
|||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
Direction preferred = getPreferredHorizontalFacing(context);
|
Direction preferred = getPreferredHorizontalFacing(context);
|
||||||
if (context.isPlacerSneaking() || preferred == null)
|
if (context.getPlayer().isSneaking() || preferred == null)
|
||||||
return super.getStateForPlacement(context);
|
return super.getStateForPlacement(context);
|
||||||
return getDefaultState().with(HORIZONTAL_FACING, preferred);
|
return getDefaultState().with(HORIZONTAL_FACING, preferred);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import net.minecraft.client.renderer.ItemRenderer;
|
|||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@ -30,6 +31,10 @@ import net.minecraft.util.math.MathHelper;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
||||||
|
|
||||||
|
public SawTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(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);
|
renderItems(te, x, y, z, partialTicks);
|
||||||
@ -71,8 +76,8 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
|
|||||||
|
|
||||||
RenderSystem.scaled(.5, .5, .5);
|
RenderSystem.scaled(.5, .5, .5);
|
||||||
if (alongZ)
|
if (alongZ)
|
||||||
RenderSystem.rotated(90, 0, 1, 0);
|
RenderSystem.rotatef(90, 0, 1, 0);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.FIXED);
|
itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.FIXED);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock {
|
|||||||
return getDefaultState().with(HORIZONTAL_FACING, placedOn.get(HORIZONTAL_FACING));
|
return getDefaultState().with(HORIZONTAL_FACING, placedOn.get(HORIZONTAL_FACING));
|
||||||
if (facing.getAxis().isHorizontal())
|
if (facing.getAxis().isHorizontal())
|
||||||
return getDefaultState().with(HORIZONTAL_FACING,
|
return getDefaultState().with(HORIZONTAL_FACING,
|
||||||
context.isPlacerSneaking() ? facing.getOpposite() : facing);
|
context.getPlayer().isSneaking() ? facing.getOpposite() : facing);
|
||||||
|
|
||||||
return super.getStateForPlacement(context);
|
return super.getStateForPlacement(context);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class GoggleOverlayRenderer {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tooltipScreen.init(mc, mc.mainWindow.getScaledWidth(), mc.mainWindow.getScaledHeight());
|
tooltipScreen.init(mc, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight());
|
||||||
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
||||||
ItemStack item = goggles;
|
ItemStack item = goggles;
|
||||||
ScreenElementRenderer.render3DItem(() -> {
|
ScreenElementRenderer.render3DItem(() -> {
|
||||||
|
@ -111,11 +111,6 @@ public class BasinBlock extends Block implements IWithTileEntity<BasinTileEntity
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSolid(BlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride(BlockState state) {
|
public boolean hasComparatorInputOverride(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,12 +2,16 @@ package com.simibubi.create.modules.contraptions.processing;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.Vector3f;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
@ -17,11 +21,16 @@ import net.minecraftforge.items.ItemStackHandler;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class BasinTileEntityRenderer extends SafeTileEntityRenderer<BasinTileEntity> {
|
public class BasinTileEntityRenderer extends SafeTileEntityRenderer<BasinTileEntity> {
|
||||||
|
|
||||||
|
public BasinTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) {
|
protected void renderSafe(BasinTileEntity basin, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
RenderSystem.pushMatrix();
|
int light, int overlay) {
|
||||||
|
ms.push();
|
||||||
BlockPos pos = basin.getPos();
|
BlockPos pos = basin.getPos();
|
||||||
RenderSystem.translated(x + .5, y + .2f, z + .5);
|
ms.translate(.5, .2f, .5);
|
||||||
Random r = new Random(pos.hashCode());
|
Random r = new Random(pos.hashCode());
|
||||||
|
|
||||||
IItemHandlerModifiable inv = basin.inventory.orElse(new ItemStackHandler());
|
IItemHandlerModifiable inv = basin.inventory.orElse(new ItemStackHandler());
|
||||||
@ -31,13 +40,13 @@ public class BasinTileEntityRenderer extends SafeTileEntityRenderer<BasinTileEnt
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (int i = 0; i <= stack.getCount() / 8; i++) {
|
for (int i = 0; i <= stack.getCount() / 8; i++) {
|
||||||
RenderSystem.pushMatrix();
|
ms.push();
|
||||||
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, .25f);
|
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, .25f);
|
||||||
Vec3d vec2 = VecHelper.offsetRandomly(Vec3d.ZERO, r, .5f);
|
Vec3d vec2 = VecHelper.offsetRandomly(Vec3d.ZERO, r, .5f);
|
||||||
RenderSystem.translated(vec.x, vec.y, vec.z);
|
ms.translate(vec.x, vec.y, vec.z);
|
||||||
RenderSystem.rotated(vec2.x * 180, vec2.z, vec2.y, 0);
|
ms.multiply(new Vector3f((float) vec2.z, (float) vec2.y, 0).getDegreesQuaternion((float) vec2.x * 180));
|
||||||
|
|
||||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.GROUND);
|
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.GROUND, light, overlay, ms, buffer);
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
}
|
}
|
||||||
RenderSystem.translated(0, 1 / 64f, 0);
|
RenderSystem.translated(0, 1 / 64f, 0);
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
package com.simibubi.create.modules.contraptions.redstone;
|
package com.simibubi.create.modules.contraptions.redstone;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.state.properties.AttachFace;
|
import net.minecraft.state.properties.AttachFace;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
|
||||||
public class AnalogLeverTileEntityRenderer extends SafeTileEntityRendererFast<AnalogLeverTileEntity> {
|
public class AnalogLeverTileEntityRenderer extends SafeTileEntityRenderer<AnalogLeverTileEntity> {
|
||||||
|
|
||||||
|
public AnalogLeverTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks,
|
public void renderFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks,
|
||||||
|
@ -41,7 +41,7 @@ public class ContactBlock extends ProperDirectionalBlock implements IPortableBlo
|
|||||||
BlockState state = getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite());
|
BlockState state = getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite());
|
||||||
Direction placeDirection = context.getFace().getOpposite();
|
Direction placeDirection = context.getFace().getOpposite();
|
||||||
|
|
||||||
if (context.isPlacerSneaking() || hasValidContact(context.getWorld(), context.getPos(), placeDirection))
|
if (context.getPlayer().isSneaking() || hasValidContact(context.getWorld(), context.getPos(), placeDirection))
|
||||||
state = state.with(FACING, placeDirection);
|
state = state.with(FACING, placeDirection);
|
||||||
if (hasValidContact(context.getWorld(), context.getPos(), state.get(FACING)))
|
if (hasValidContact(context.getWorld(), context.getPos(), state.get(FACING)))
|
||||||
state = state.with(POWERED, true);
|
state = state.with(POWERED, true);
|
||||||
|
@ -10,10 +10,15 @@ import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
|||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
|
||||||
public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedControllerTileEntity> {
|
public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedControllerTileEntity> {
|
||||||
|
|
||||||
|
public SpeedControllerRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(SpeedControllerTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
|
public void renderWithGL(SpeedControllerTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
|
||||||
int destroyStage) {
|
int destroyStage) {
|
||||||
|
@ -102,7 +102,7 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock
|
|||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
Axis preferredAxis = RotatedPillarKineticBlock.getPreferredAxis(context);
|
Axis preferredAxis = RotatedPillarKineticBlock.getPreferredAxis(context);
|
||||||
if (preferredAxis != null && !context.isPlacerSneaking())
|
if (preferredAxis != null && !context.getPlayer().isSneaking())
|
||||||
return withAxis(preferredAxis, context);
|
return withAxis(preferredAxis, context);
|
||||||
return withAxis(context.getNearestLookingDirection().getAxis(), context);
|
return withAxis(context.getNearestLookingDirection().getAxis(), context);
|
||||||
}
|
}
|
||||||
|
@ -391,10 +391,10 @@ public class BeltBlock extends HorizontalKineticBlock
|
|||||||
: BlockRenderType.ENTITYBLOCK_ANIMATED;
|
: BlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override // TODO 1.15 register layer
|
||||||
public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
|
// public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
|
||||||
return state.get(CASING) && state.get(SLOPE) != Slope.VERTICAL && layer == getRenderLayer();
|
// return state.get(CASING) && state.get(SLOPE) != Slope.VERTICAL && layer == getRenderLayer();
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static void initBelt(World world, BlockPos pos) {
|
public static void initBelt(World world, BlockPos pos) {
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
|
@ -37,7 +37,7 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResultType onItemUse(ItemUseContext context) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
if (context.isPlacerSneaking()) {
|
if (context.getPlayer().isSneaking()) {
|
||||||
context.getItem().setTag(null);
|
context.getItem().setTag(null);
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class BeltMovementHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Not on top
|
// Not on top
|
||||||
if (entityIn.posY - .25f < pos.getY())
|
if (entityIn.getY() - .25f < pos.getY())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Lock entities in place
|
// Lock entities in place
|
||||||
@ -113,15 +113,15 @@ public class BeltMovementHandler {
|
|||||||
Direction.getFacingFromAxis(POSITIVE, beltFacing.rotateY().getAxis()).getDirectionVec();
|
Direction.getFacingFromAxis(POSITIVE, beltFacing.rotateY().getAxis()).getDirectionVec();
|
||||||
Vec3d movement = new Vec3d(movementDirection.getDirectionVec()).scale(movementSpeed);
|
Vec3d movement = new Vec3d(movementDirection.getDirectionVec()).scale(movementSpeed);
|
||||||
|
|
||||||
double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.posX) : (pos.getZ() + .5f - entityIn.posZ);
|
double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.getZ()) : (pos.getZ() + .5f - entityIn.getZ());
|
||||||
if (Math.abs(diffCenter) > 48 / 64f)
|
if (Math.abs(diffCenter) > 48 / 64f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Part part = blockState.get(BeltBlock.PART);
|
Part part = blockState.get(BeltBlock.PART);
|
||||||
float top = 13 / 16f;
|
float top = 13 / 16f;
|
||||||
boolean onSlope = notHorizontal && (part == Part.MIDDLE || part == Part.PULLEY
|
boolean onSlope = notHorizontal && (part == Part.MIDDLE || part == Part.PULLEY
|
||||||
|| part == (slope == Slope.UPWARD ? Part.END : Part.START) && entityIn.posY - pos.getY() < top
|
|| part == (slope == Slope.UPWARD ? Part.END : Part.START) && entityIn.getY() - pos.getY() < top
|
||||||
|| part == (slope == Slope.UPWARD ? Part.START : Part.END) && entityIn.posY - pos.getY() > top);
|
|| part == (slope == Slope.UPWARD ? Part.START : Part.END) && entityIn.getY() - pos.getY() > top);
|
||||||
|
|
||||||
boolean movingDown = onSlope && slope == (movementFacing == beltFacing ? Slope.DOWNWARD : Slope.UPWARD);
|
boolean movingDown = onSlope && slope == (movementFacing == beltFacing ? Slope.DOWNWARD : Slope.UPWARD);
|
||||||
boolean movingUp = onSlope && slope == (movementFacing == beltFacing ? Slope.UPWARD : Slope.DOWNWARD);
|
boolean movingUp = onSlope && slope == (movementFacing == beltFacing ? Slope.UPWARD : Slope.DOWNWARD);
|
||||||
@ -181,7 +181,7 @@ public class BeltMovementHandler {
|
|||||||
|| AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition().down())));
|
|| AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition().down())));
|
||||||
|
|
||||||
if (movedPastEndingSlope && !movingDown && Math.abs(movementSpeed) > 0)
|
if (movedPastEndingSlope && !movingDown && Math.abs(movementSpeed) > 0)
|
||||||
entityIn.setPosition(entityIn.posX, entityIn.posY + movement.y, entityIn.posZ);
|
entityIn.setPosition(entityIn.getY(), entityIn.getY() + movement.y, entityIn.getZ());
|
||||||
if (movedPastEndingSlope) {
|
if (movedPastEndingSlope) {
|
||||||
entityIn.setMotion(movement);
|
entityIn.setMotion(movement);
|
||||||
entityIn.velocityChanged = true;
|
entityIn.velocityChanged = true;
|
||||||
|
@ -26,6 +26,7 @@ import net.minecraft.client.renderer.ItemRenderer;
|
|||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
@ -38,6 +39,10 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||||||
|
|
||||||
private static SpriteShiftEntry animatedTexture;
|
private static SpriteShiftEntry animatedTexture;
|
||||||
|
|
||||||
|
public BeltTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
|
public void renderWithGL(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||||
TessellatorHelper.prepareFastRender();
|
TessellatorHelper.prepareFastRender();
|
||||||
@ -148,7 +153,7 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||||||
RenderHelper.enableStandardItemLighting();
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
|
||||||
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
|
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
|
||||||
RenderSystem.rotated(slopeAngle, slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0);
|
RenderSystem.rotatef(slopeAngle, slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0);
|
||||||
if (onSlope)
|
if (onSlope)
|
||||||
RenderSystem.translated(0, 1 / 8f, 0);
|
RenderSystem.translated(0, 1 / 8f, 0);
|
||||||
Random r = new Random(transported.angle);
|
Random r = new Random(transported.angle);
|
||||||
@ -156,10 +161,10 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||||||
for (int i = 0; i <= count; i++) {
|
for (int i = 0; i <= count; i++) {
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
|
|
||||||
RenderSystem.rotated(transported.angle, 0, 1, 0);
|
RenderSystem.rotatef(transported.angle, 0, 1, 0);
|
||||||
if (!blockItem) {
|
if (!blockItem) {
|
||||||
RenderSystem.translated(0, -.09375, 0);
|
RenderSystem.translated(0, -.09375, 0);
|
||||||
RenderSystem.rotated(90, 1, 0, 0);
|
RenderSystem.rotatef(90, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockItem) {
|
if (blockItem) {
|
||||||
@ -171,7 +176,7 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
if (!blockItem)
|
if (!blockItem)
|
||||||
RenderSystem.rotated(10, 0, 1, 0);
|
RenderSystem.rotatef(10, 0, 1, 0);
|
||||||
RenderSystem.translated(0, blockItem ? 1 / 64d : 1 / 16d, 0);
|
RenderSystem.translated(0, blockItem ? 1 / 64d : 1 / 16d, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import net.minecraft.state.StateContainer.Builder;
|
|||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
@ -58,11 +57,6 @@ public class BeltTunnelBlock extends Block implements IWithTileEntity<BeltTunnel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSolid(BlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
return BeltTunnelShapes.getShape(state);
|
return BeltTunnelShapes.getShape(state);
|
||||||
@ -85,12 +79,12 @@ public class BeltTunnelBlock extends Block implements IWithTileEntity<BeltTunnel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override // TODO 1.15 register layer
|
||||||
public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
|
// public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
|
||||||
if (hasWindow(state))
|
// if (hasWindow(state))
|
||||||
return layer == BlockRenderLayer.CUTOUT_MIPPED;
|
// return layer == BlockRenderLayer.CUTOUT_MIPPED;
|
||||||
return super.canRenderInLayer(state, layer);
|
// return super.canRenderInLayer(state, layer);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static boolean hasWindow(BlockState state) {
|
public static boolean hasWindow(BlockState state) {
|
||||||
Shape shape = state.get(SHAPE);
|
Shape shape = state.get(SHAPE);
|
||||||
|
@ -1,26 +1,35 @@
|
|||||||
package com.simibubi.create.modules.contraptions.relays.belt;
|
package com.simibubi.create.modules.contraptions.relays.belt;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BeltTunnelTileEntityRenderer extends SafeTileEntityRendererFast<BeltTunnelTileEntity> {
|
public class BeltTunnelTileEntityRenderer extends SafeTileEntityRenderer<BeltTunnelTileEntity> {
|
||||||
|
|
||||||
|
public BeltTunnelTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFast(BeltTunnelTileEntity te, double x, double y, double z, float partialTicks,
|
protected void renderSafe(BeltTunnelTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int destroyStage, BufferBuilder buffer) {
|
int light, int overlay) {
|
||||||
SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState());
|
SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState());
|
||||||
SuperByteBuffer indicatorBuffer = AllBlockPartials.BELT_TUNNEL_INDICATOR.renderOn(te.getBlockState());
|
SuperByteBuffer indicatorBuffer = AllBlockPartials.BELT_TUNNEL_INDICATOR.renderOn(te.getBlockState());
|
||||||
BlockPos pos = te.getPos();
|
BlockPos pos = te.getPos();
|
||||||
World world = getWorld();
|
World world = te.getWorld();
|
||||||
|
|
||||||
for (Direction direction : Direction.values()) {
|
for (Direction direction : Direction.values()) {
|
||||||
if (!te.flaps.containsKey(direction))
|
if (!te.flaps.containsKey(direction))
|
||||||
@ -44,19 +53,21 @@ public class BeltTunnelTileEntityRenderer extends SafeTileEntityRendererFast<Bel
|
|||||||
float flapAngle = MathHelper.sin((float) ((1 - abs) * Math.PI * intensity)) * 30 * -f;
|
float flapAngle = MathHelper.sin((float) ((1 - abs) * Math.PI * intensity)) * 30 * -f;
|
||||||
flapAngle = (float) (flapAngle / 180 * Math.PI);
|
flapAngle = (float) (flapAngle / 180 * Math.PI);
|
||||||
|
|
||||||
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
|
|
||||||
if (te.syncedFlaps.containsKey(direction)) {
|
if (te.syncedFlaps.containsKey(direction)) {
|
||||||
float lightIntensity = abs * abs * abs;
|
float lightIntensity = abs * abs * abs;
|
||||||
int color = ColorHelper.mixColors(0x808080, 0xFFFFFF, lightIntensity);
|
int color = ColorHelper.mixColors(0x808080, 0xFFFFFF, lightIntensity);
|
||||||
indicatorBuffer.rotateCentered(Axis.Y, (float) ((horizontalAngle + 90) / 180f * Math.PI))
|
indicatorBuffer.rotateCentered(Axis.Y, (float) ((horizontalAngle + 90) / 180f * Math.PI))
|
||||||
.translate(x, y, z).color(color)
|
.color(color)
|
||||||
.light(world.getCombinedLight(pos, (int) (12 * lightIntensity))).renderInto(buffer);
|
.light(world.getCombinedLight(pos, (int) (12 * lightIntensity))).renderInto(ms, vb);
|
||||||
}
|
}
|
||||||
|
|
||||||
flapBuffer.translate(0, 0, -segment * 3 / 16f);
|
flapBuffer.translate(0, 0, -segment * 3 / 16f);
|
||||||
flapBuffer.translate(flapPivotX, flapPivotY, flapPivotZ).rotate(Axis.Z, flapAngle)
|
flapBuffer.translate(flapPivotX, flapPivotY, flapPivotZ).rotate(Axis.Z, flapAngle)
|
||||||
.translate(-flapPivotX, -flapPivotY, -flapPivotZ);
|
.translate(-flapPivotX, -flapPivotY, -flapPivotZ);
|
||||||
flapBuffer.rotateCentered(Axis.Y, (float) (horizontalAngle / 180f * Math.PI)).translate(x, y, z);
|
flapBuffer.rotateCentered(Axis.Y, (float) (horizontalAngle / 180f * Math.PI));
|
||||||
flapBuffer.light(te.getBlockState().getPackedLightmapCoords(world, pos)).renderInto(buffer);
|
flapBuffer.light(te.getBlockState().getPackedLightmapCoords(world, pos)).renderInto(ms, vb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
|
|||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
Axis placedAxis = context.getNearestLookingDirection().getAxis();
|
Axis placedAxis = context.getNearestLookingDirection().getAxis();
|
||||||
Axis axis = context.isPlacerSneaking() ? placedAxis : getPreferredAxis(context);
|
Axis axis = context.getPlayer().isSneaking() ? placedAxis : getPreferredAxis(context);
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
axis = placedAxis;
|
axis = placedAxis;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
if (context.isPlacerSneaking())
|
if (context.getPlayer().isSneaking())
|
||||||
return super.getStateForPlacement(context);
|
return super.getStateForPlacement(context);
|
||||||
Axis preferredAxis = getPreferredAxis(context);
|
Axis preferredAxis = getPreferredAxis(context);
|
||||||
return this.getDefaultState().with(AXIS,
|
return this.getDefaultState().with(AXIS,
|
||||||
|
@ -14,6 +14,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
@ -23,7 +24,8 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
|||||||
|
|
||||||
protected GaugeBlock.Type type;
|
protected GaugeBlock.Type type;
|
||||||
|
|
||||||
public GaugeTileEntityRenderer(GaugeBlock.Type type) {
|
public GaugeTileEntityRenderer(TileEntityRendererDispatcher dispatcher, GaugeBlock.Type type) {
|
||||||
|
super(dispatcher);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class DeforesterItemRenderer extends ItemStackTileEntityRenderer {
|
|||||||
float xOffset = 0;
|
float xOffset = 0;
|
||||||
float zOffset = 0;
|
float zOffset = 0;
|
||||||
RenderSystem.translatef(-xOffset, 0, -zOffset);
|
RenderSystem.translatef(-xOffset, 0, -zOffset);
|
||||||
RenderSystem.rotated(angle, 0, 1, 0);
|
RenderSystem.rotatef(angle, 0, 1, 0);
|
||||||
RenderSystem.translatef(xOffset, 0, zOffset);
|
RenderSystem.translatef(xOffset, 0, zOffset);
|
||||||
|
|
||||||
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
|
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
|
||||||
|
@ -36,7 +36,7 @@ public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer {
|
|||||||
float floating = MathHelper.sin(worldTime) * .05f;
|
float floating = MathHelper.sin(worldTime) * .05f;
|
||||||
RenderSystem.translated(0, floating, 0);
|
RenderSystem.translated(0, floating, 0);
|
||||||
float angle = worldTime * -10 % 360;
|
float angle = worldTime * -10 % 360;
|
||||||
RenderSystem.rotated(angle, 0, 1, 0);
|
RenderSystem.rotatef(angle, 0, 1, 0);
|
||||||
itemRenderer.renderItem(stack, mainModel.getPartial("bits"));
|
itemRenderer.renderItem(stack, mainModel.getPartial("bits"));
|
||||||
|
|
||||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||||
|
@ -78,7 +78,7 @@ public abstract class ZapperItem extends Item {
|
|||||||
@Override
|
@Override
|
||||||
public ActionResultType onItemUse(ItemUseContext context) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
// Shift -> open GUI
|
// Shift -> open GUI
|
||||||
if (context.isPlacerSneaking()) {
|
if (context.getPlayer().isSneaking()) {
|
||||||
if (context.getWorld().isRemote) {
|
if (context.getWorld().isRemote) {
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
openHandgunGUI(context.getItem(), context.getHand() == Hand.OFF_HAND);
|
openHandgunGUI(context.getItem(), context.getHand() == Hand.OFF_HAND);
|
||||||
|
@ -4,10 +4,15 @@ import com.mojang.blaze3d.platform.GLX;
|
|||||||
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
|
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
|
||||||
public class BeltObserverTileEntityRenderer extends SafeTileEntityRenderer<BeltObserverTileEntity> {
|
public class BeltObserverTileEntityRenderer extends SafeTileEntityRenderer<BeltObserverTileEntity> {
|
||||||
|
|
||||||
|
public BeltObserverTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(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) {
|
int destroyStage) {
|
||||||
|
@ -5,8 +5,14 @@ import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRende
|
|||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
|
||||||
public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRenderer<FlexpeaterTileEntity> {
|
public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRenderer<FlexpeaterTileEntity> {
|
||||||
|
|
||||||
|
public FlexpeaterTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getColor(FlexpeaterTileEntity te, float partialTicks) {
|
protected int getColor(FlexpeaterTileEntity te, float partialTicks) {
|
||||||
return ColorHelper.mixColors(0x2C0300, 0xCD0000, te.state / (float) te.maxState.getValue());
|
return ColorHelper.mixColors(0x2C0300, 0xCD0000, te.state / (float) te.maxState.getValue());
|
||||||
|
@ -56,7 +56,7 @@ public class FlexcrateBlock extends ProperDirectionalBlock {
|
|||||||
BlockPos pos = context.getPos();
|
BlockPos pos = context.getPos();
|
||||||
World world = context.getWorld();
|
World world = context.getWorld();
|
||||||
|
|
||||||
if (!context.isPlacerSneaking()) {
|
if (!context.getPlayer().isSneaking()) {
|
||||||
for (Direction d : Direction.values()) {
|
for (Direction d : Direction.values()) {
|
||||||
BlockState state = world.getBlockState(pos.offset(d));
|
BlockState state = world.getBlockState(pos.offset(d));
|
||||||
if (AllBlocks.FLEXCRATE.typeOf(state) && !state.get(DOUBLE))
|
if (AllBlocks.FLEXCRATE.typeOf(state) && !state.get(DOUBLE))
|
||||||
|
@ -61,7 +61,7 @@ public class MaterialChecklist {
|
|||||||
string.append("\n" + TextFormatting.RED + "* Disclaimer *\n\n");
|
string.append("\n" + TextFormatting.RED + "* Disclaimer *\n\n");
|
||||||
string.append("Material List may be inaccurate due to relevant chunks not being loaded.");
|
string.append("Material List may be inaccurate due to relevant chunks not being loaded.");
|
||||||
string.append("\"}");
|
string.append("\"}");
|
||||||
pages.add(new StringNBT(string.toString()));
|
pages.add(StringNBT.of(string.toString()));
|
||||||
string = new StringBuilder("{\"text\":\"");
|
string = new StringBuilder("{\"text\":\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public class MaterialChecklist {
|
|||||||
if (itemsWritten == 6) {
|
if (itemsWritten == 6) {
|
||||||
itemsWritten = 0;
|
itemsWritten = 0;
|
||||||
string.append("\"}");
|
string.append("\"}");
|
||||||
pages.add(new StringNBT(string.toString()));
|
pages.add(StringNBT.of(string.toString()));
|
||||||
string = new StringBuilder("{\"text\":\"");
|
string = new StringBuilder("{\"text\":\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public class MaterialChecklist {
|
|||||||
if (itemsWritten == 6) {
|
if (itemsWritten == 6) {
|
||||||
itemsWritten = 0;
|
itemsWritten = 0;
|
||||||
string.append("\"}");
|
string.append("\"}");
|
||||||
pages.add(new StringNBT(string.toString()));
|
pages.add(StringNBT.of(string.toString()));
|
||||||
string = new StringBuilder("{\"text\":\"");
|
string = new StringBuilder("{\"text\":\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public class MaterialChecklist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string.append("\"}");
|
string.append("\"}");
|
||||||
pages.add(new StringNBT(string.toString()));
|
pages.add(StringNBT.of(string.toString()));
|
||||||
|
|
||||||
tag.put("pages", pages);
|
tag.put("pages", pages);
|
||||||
tag.putString("author", "Schematicannon");
|
tag.putString("author", "Schematicannon");
|
||||||
|
@ -78,7 +78,7 @@ public class SchematicWorld extends WrappedWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightFor(LightType type, BlockPos pos) {
|
public int getLightLevel(LightType p_226658_1_, BlockPos p_226658_2_) {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,11 +98,6 @@ public class SchematicWorld extends WrappedWorld {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightSubtracted(BlockPos pos, int amount) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSkylightSubtracted() {
|
public int getSkylightSubtracted() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -6,6 +6,8 @@ import static com.simibubi.create.ScreenResources.SCHEMATIC_TABLE_PROGRESS;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
@ -125,7 +127,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
RenderSystem.alphaFunc(516, 0.1F);
|
RenderSystem.alphaFunc(516, 0.1F);
|
||||||
RenderSystem.blendFunc(RenderSystem.SourceFactor.SRC_ALPHA, RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA);
|
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
RenderSystem.translated(mainLeft + 270, mainTop + 100, 200);
|
RenderSystem.translated(mainLeft + 270, mainTop + 100, 200);
|
||||||
|
@ -2,6 +2,7 @@ package com.simibubi.create.modules.schematics.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
@ -11,8 +12,10 @@ import com.simibubi.create.foundation.utility.TessellatorHelper;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.particles.ParticleTypes;
|
import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
@ -22,9 +25,13 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
|
|
||||||
public class SchematicannonRenderer extends SafeTileEntityRenderer<SchematicannonTileEntity> {
|
public class SchematicannonRenderer extends SafeTileEntityRenderer<SchematicannonTileEntity> {
|
||||||
|
|
||||||
|
public SchematicannonRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWithGL(SchematicannonTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
|
protected void renderSafe(SchematicannonTileEntity tileEntityIn, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int destroyStage) {
|
int light, int overlay) {
|
||||||
|
|
||||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||||
|
|
||||||
@ -81,13 +88,14 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||||||
double yOffset = 2 * (1 - t) * t * throwHeight + t * t * targetY;
|
double yOffset = 2 * (1 - t) * t * throwHeight + t * t * targetY;
|
||||||
Vec3d blockLocation = blockLocationXZ.add(0, yOffset + 1, 0).add(cannonOffset);
|
Vec3d blockLocation = blockLocationXZ.add(0, yOffset + 1, 0).add(cannonOffset);
|
||||||
|
|
||||||
|
// TODO 1.15 remove RenderSystem use
|
||||||
// Offset to position
|
// Offset to position
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.translated(blockLocation.x, blockLocation.y, blockLocation.z);
|
RenderSystem.translated(blockLocation.x, blockLocation.y, blockLocation.z);
|
||||||
|
|
||||||
// Rotation and Scaling effects
|
// Rotation and Scaling effects
|
||||||
double scale = .3f;
|
double scale = .3f;
|
||||||
RenderSystem.rotated(360 * t * 2, 1, 1, 0);
|
RenderSystem.rotatef(360 * t * 2, 1, 1, 0);
|
||||||
RenderSystem.scaled(scale, scale, scale);
|
RenderSystem.scaled(scale, scale, scale);
|
||||||
|
|
||||||
// Render the Block
|
// Render the Block
|
||||||
|
@ -10,7 +10,7 @@ import net.minecraft.client.gui.AbstractGui;
|
|||||||
public class BlueprintHotbarOverlay extends AbstractGui {
|
public class BlueprintHotbarOverlay extends AbstractGui {
|
||||||
|
|
||||||
public void renderOn(int slot) {
|
public void renderOn(int slot) {
|
||||||
MainWindow mainWindow = Minecraft.getInstance().mainWindow;
|
MainWindow mainWindow = Minecraft.getInstance().getWindow();
|
||||||
int x = mainWindow.getScaledWidth() / 2 - 92;
|
int x = mainWindow.getScaledWidth() / 2 - 92;
|
||||||
int y = mainWindow.getScaledHeight() - 23;
|
int y = mainWindow.getScaledHeight() - 23;
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
|
@ -8,7 +8,9 @@ import java.nio.file.StandardOpenOption;
|
|||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllKeys;
|
import com.simibubi.create.AllKeys;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
import com.simibubi.create.AllSpecialTextures;
|
||||||
@ -160,7 +162,7 @@ public class SchematicAndQuillHandler {
|
|||||||
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
|
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render() {
|
public void render(MatrixStack ms, IVertexBuilder buffer) {
|
||||||
if (!isActive())
|
if (!isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -175,28 +177,28 @@ public class SchematicAndQuillHandler {
|
|||||||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, firstPos.add(1, 1, 1));
|
MutableBoundingBox bb = new MutableBoundingBox(firstPos, firstPos.add(1, 1, 1));
|
||||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||||
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
drawBox(min, max, true);
|
drawBox(ms, buffer, min, max, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstPos != null && selectedPos != null) {
|
if (firstPos != null && selectedPos != null) {
|
||||||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, selectedPos);
|
MutableBoundingBox bb = new MutableBoundingBox(firstPos, selectedPos);
|
||||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||||
BlockPos max = new BlockPos(bb.maxX + 1, bb.maxY + 1, bb.maxZ + 1);
|
BlockPos max = new BlockPos(bb.maxX + 1, bb.maxY + 1, bb.maxZ + 1);
|
||||||
drawBox(min, max, true);
|
drawBox(ms, buffer, min, max, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstPos == null && selectedPos != null) {
|
if (firstPos == null && selectedPos != null) {
|
||||||
MutableBoundingBox bb = new MutableBoundingBox(selectedPos, selectedPos.add(1, 1, 1));
|
MutableBoundingBox bb = new MutableBoundingBox(selectedPos, selectedPos.add(1, 1, 1));
|
||||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||||
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
drawBox(min, max, true);
|
drawBox(ms, buffer, min, max, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 2nd Step
|
// 2nd Step
|
||||||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, secondPos);
|
MutableBoundingBox bb = new MutableBoundingBox(firstPos, secondPos);
|
||||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||||
BlockPos max = new BlockPos(bb.maxX + 1, bb.maxY + 1, bb.maxZ + 1);
|
BlockPos max = new BlockPos(bb.maxX + 1, bb.maxY + 1, bb.maxZ + 1);
|
||||||
drawBox(min, max, false);
|
drawBox(ms, buffer, min, max, false);
|
||||||
|
|
||||||
if (selectedFace != null) {
|
if (selectedFace != null) {
|
||||||
Vec3d vec = new Vec3d(selectedFace.getDirectionVec());
|
Vec3d vec = new Vec3d(selectedFace.getDirectionVec());
|
||||||
@ -226,10 +228,10 @@ public class SchematicAndQuillHandler {
|
|||||||
TessellatorHelper.cleanUpAfterDrawing();
|
TessellatorHelper.cleanUpAfterDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void drawBox(BlockPos min, BlockPos max, boolean blue) {
|
protected static void drawBox(MatrixStack ms, IVertexBuilder buffer, BlockPos min, BlockPos max, boolean blue) {
|
||||||
float red = blue ? .8f : 1;
|
float red = blue ? .8f : 1;
|
||||||
float green = blue ? .9f : 1;
|
float green = blue ? .9f : 1;
|
||||||
WorldRenderer.drawBoundingBox(min.getX() - 1 / 16d, min.getY() + 1 / 16d, min.getZ() - 1 / 16d,
|
WorldRenderer.drawBox(ms, buffer, min.getX() - 1 / 16d, min.getY() + 1 / 16d, min.getZ() - 1 / 16d,
|
||||||
max.getX() + 1 / 16d, max.getY() + 1 / 16d, max.getZ() + 1 / 16d, red, green, 1, 1);
|
max.getX() + 1 / 16d, max.getY() + 1 / 16d, max.getZ() + 1 / 16d, red, green, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class SchematicItem extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResultType onItemUse(ItemUseContext context) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
if (context.isPlacerSneaking() && context.getHand() == Hand.MAIN_HAND) {
|
if (context.getPlayer().isSneaking() && context.getHand() == Hand.MAIN_HAND) {
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
displayBlueprintScreen();
|
displayBlueprintScreen();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user