Merge remote-tracking branch 'upstream/mc1.15/dev' into mc1.15/dev
@ -335,7 +335,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
|
|||||||
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
|
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
|
||||||
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
|
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
|
||||||
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
|
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
|
||||||
89b63c6e5875da07226854651079bcea85439f5b assets/create/blockstates/radial_chassis.json
|
bdd56f32ce0a148b6e466a55ab2777f69fc08cfc assets/create/blockstates/radial_chassis.json
|
||||||
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
|
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
|
||||||
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
|
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
|
||||||
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json
|
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json
|
||||||
|
@ -89,8 +89,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_west": "true",
|
"axis": "x",
|
||||||
"axis": "x"
|
"sticky_west": "true"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_x_sticky",
|
"model": "create:block/radial_chassis_side_x_sticky",
|
||||||
@ -99,8 +99,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_west": "true",
|
"axis": "y",
|
||||||
"axis": "y"
|
"sticky_west": "true"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_y_sticky",
|
"model": "create:block/radial_chassis_side_y_sticky",
|
||||||
@ -109,8 +109,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_west": "true",
|
"axis": "z",
|
||||||
"axis": "z"
|
"sticky_west": "true"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_z_sticky",
|
"model": "create:block/radial_chassis_side_z_sticky",
|
||||||
@ -119,8 +119,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_west": "false",
|
"axis": "x",
|
||||||
"axis": "x"
|
"sticky_west": "false"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_x",
|
"model": "create:block/radial_chassis_side_x",
|
||||||
@ -129,8 +129,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_west": "false",
|
"axis": "y",
|
||||||
"axis": "y"
|
"sticky_west": "false"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_y",
|
"model": "create:block/radial_chassis_side_y",
|
||||||
@ -139,8 +139,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_west": "false",
|
"axis": "z",
|
||||||
"axis": "z"
|
"sticky_west": "false"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_z",
|
"model": "create:block/radial_chassis_side_z",
|
||||||
@ -207,8 +207,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_east": "true",
|
"axis": "x",
|
||||||
"axis": "x"
|
"sticky_east": "true"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_x_sticky",
|
"model": "create:block/radial_chassis_side_x_sticky",
|
||||||
@ -217,8 +217,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_east": "true",
|
"axis": "y",
|
||||||
"axis": "y"
|
"sticky_east": "true"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_y_sticky",
|
"model": "create:block/radial_chassis_side_y_sticky",
|
||||||
@ -227,8 +227,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_east": "true",
|
"axis": "z",
|
||||||
"axis": "z"
|
"sticky_east": "true"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_z_sticky"
|
"model": "create:block/radial_chassis_side_z_sticky"
|
||||||
@ -236,8 +236,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_east": "false",
|
"axis": "x",
|
||||||
"axis": "x"
|
"sticky_east": "false"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_x",
|
"model": "create:block/radial_chassis_side_x",
|
||||||
@ -246,8 +246,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_east": "false",
|
"axis": "y",
|
||||||
"axis": "y"
|
"sticky_east": "false"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_y",
|
"model": "create:block/radial_chassis_side_y",
|
||||||
@ -256,8 +256,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": {
|
"when": {
|
||||||
"sticky_east": "false",
|
"axis": "z",
|
||||||
"axis": "z"
|
"sticky_east": "false"
|
||||||
},
|
},
|
||||||
"apply": {
|
"apply": {
|
||||||
"model": "create:block/radial_chassis_side_z"
|
"model": "create:block/radial_chassis_side_z"
|
||||||
|
@ -94,7 +94,6 @@ import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerB
|
|||||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock;
|
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftGenerator;
|
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftGenerator;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltColor;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltGenerator;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltGenerator;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltModel;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltModel;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.BracketedKineticBlockModel;
|
import com.simibubi.create.content.contraptions.relays.elementary.BracketedKineticBlockModel;
|
||||||
@ -314,7 +313,6 @@ public class AllBlocks {
|
|||||||
.properties(p -> p.hardnessAndResistance(0.8F))
|
.properties(p -> p.hardnessAndResistance(0.8F))
|
||||||
.blockstate(new BeltGenerator()::generate)
|
.blockstate(new BeltGenerator()::generate)
|
||||||
.transform(StressConfigDefaults.setImpact(1.0))
|
.transform(StressConfigDefaults.setImpact(1.0))
|
||||||
.onRegister(CreateRegistrate.blockColors(() -> BeltColor::new))
|
|
||||||
.onRegister(CreateRegistrate.blockModel(() -> BeltModel::new))
|
.onRegister(CreateRegistrate.blockModel(() -> BeltModel::new))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
@ -18,44 +18,40 @@ import com.simibubi.create.foundation.block.render.SpriteShifter;
|
|||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.block.WoodType;
|
import net.minecraft.block.WoodType;
|
||||||
|
import net.minecraft.item.DyeColor;
|
||||||
|
|
||||||
public class AllSpriteShifts {
|
public class AllSpriteShifts {
|
||||||
|
|
||||||
static final Map<WoodType, CTSpriteShiftEntry>
|
static final Map<WoodType, CTSpriteShiftEntry> WOODEN_WINDOWS = new IdentityHashMap<>();
|
||||||
WOODEN_WINDOWS = new IdentityHashMap<>();
|
static final Map<PaletteStoneVariants, Map<PaletteBlockPatterns.CTs, CTSpriteShiftEntry>> PALETTE_VARIANT_PATTERNS =
|
||||||
static final Map<PaletteStoneVariants, Map<PaletteBlockPatterns.CTs, CTSpriteShiftEntry>>
|
new IdentityHashMap<>();
|
||||||
PALETTE_VARIANT_PATTERNS = new IdentityHashMap<>();
|
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry
|
public static final Map<DyeColor, SpriteShiftEntry> DYED_BELTS = new IdentityHashMap<>(),
|
||||||
FRAMED_GLASS = getCT(OMNIDIRECTIONAL, "palettes/framed_glass", "palettes/framed_glass"),
|
DYED_OFFSET_BELTS = new IdentityHashMap<>(), DYED_DIAGONAL_BELTS = new IdentityHashMap<>();
|
||||||
|
|
||||||
|
public static final CTSpriteShiftEntry FRAMED_GLASS =
|
||||||
|
getCT(OMNIDIRECTIONAL, "palettes/framed_glass", "palettes/framed_glass"),
|
||||||
HORIZONTAL_FRAMED_GLASS = getCT(HORIZONTAL, "palettes/framed_glass", "palettes/horizontal_framed_glass"),
|
HORIZONTAL_FRAMED_GLASS = getCT(HORIZONTAL, "palettes/framed_glass", "palettes/horizontal_framed_glass"),
|
||||||
VERTICAL_FRAMED_GLASS = getCT(VERTICAL, "palettes/framed_glass", "palettes/vertical_framed_glass"),
|
VERTICAL_FRAMED_GLASS = getCT(VERTICAL, "palettes/framed_glass", "palettes/vertical_framed_glass"),
|
||||||
ORNATE_IRON_WINDOW = vertical("palettes/ornate_iron_window");
|
ORNATE_IRON_WINDOW = vertical("palettes/ornate_iron_window");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry
|
public static final CTSpriteShiftEntry CRAFTER_FRONT = getCT(CTType.OMNIDIRECTIONAL, "crafter_top", "brass_casing"),
|
||||||
CRAFTER_FRONT = getCT(CTType.OMNIDIRECTIONAL, "crafter_top", "brass_casing"),
|
|
||||||
CRAFTER_SIDE = getCT(CTType.VERTICAL, "crafter_side"),
|
CRAFTER_SIDE = getCT(CTType.VERTICAL, "crafter_side"),
|
||||||
CRAFTER_OTHERSIDE = getCT(CTType.HORIZONTAL, "crafter_side");
|
CRAFTER_OTHERSIDE = getCT(CTType.HORIZONTAL, "crafter_side");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry
|
public static final CTSpriteShiftEntry ANDESITE_CASING = omni("andesite_casing"),
|
||||||
ANDESITE_CASING = omni("andesite_casing"),
|
BRASS_CASING = omni("brass_casing"), COPPER_CASING = omni("copper_casing"),
|
||||||
BRASS_CASING = omni("brass_casing"),
|
SHADOW_STEEL_CASING = omni("shadow_steel_casing"), REFINED_RADIANCE_CASING = omni("refined_radiance_casing"),
|
||||||
COPPER_CASING = omni("copper_casing"),
|
|
||||||
SHADOW_STEEL_CASING = omni("shadow_steel_casing"),
|
|
||||||
REFINED_RADIANCE_CASING = omni("refined_radiance_casing"),
|
|
||||||
CREATIVE_CASING = getCT(CTType.CROSS, "creative_casing");
|
CREATIVE_CASING = getCT(CTType.CROSS, "creative_casing");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry
|
public static final CTSpriteShiftEntry CHASSIS = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end"),
|
||||||
CHASSIS = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end"),
|
|
||||||
CHASSIS_STICKY = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end_sticky");
|
CHASSIS_STICKY = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end_sticky");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry
|
public static final CTSpriteShiftEntry BRASS_TUNNEL_TOP = vertical("brass_tunnel_top"),
|
||||||
BRASS_TUNNEL_TOP = vertical("brass_tunnel_top"),
|
|
||||||
FLUID_TANK = getCT(CTType.CROSS, "fluid_tank"),
|
FLUID_TANK = getCT(CTType.CROSS, "fluid_tank"),
|
||||||
CREATIVE_FLUID_TANK = getCT(CTType.CROSS, "creative_fluid_tank");
|
CREATIVE_FLUID_TANK = getCT(CTType.CROSS, "creative_fluid_tank");
|
||||||
|
|
||||||
public static final SpriteShiftEntry
|
public static final SpriteShiftEntry BELT = SpriteShifter.get("block/belt", "block/belt_animated"),
|
||||||
BELT = SpriteShifter.get("block/belt", "block/belt_animated"),
|
|
||||||
BELT_OFFSET = SpriteShifter.get("block/belt_offset", "block/belt_animated"),
|
BELT_OFFSET = SpriteShifter.get("block/belt_offset", "block/belt_animated"),
|
||||||
BELT_DIAGONAL = SpriteShifter.get("block/belt_diagonal", "block/belt_diagonal_animated"),
|
BELT_DIAGONAL = SpriteShifter.get("block/belt_diagonal", "block/belt_diagonal_animated"),
|
||||||
ANDESIDE_BELT_CASING = SpriteShifter.get("block/brass_casing_belt", "block/andesite_casing_belt"),
|
ANDESIDE_BELT_CASING = SpriteShifter.get("block/brass_casing_belt", "block/andesite_casing_belt"),
|
||||||
@ -93,6 +89,13 @@ public class AllSpriteShifts {
|
|||||||
map.put(texture, getCT(texture.type, target));
|
map.put(texture, getCT(texture.type, target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (DyeColor color : DyeColor.values()) {
|
||||||
|
String id = color.getName();
|
||||||
|
DYED_BELTS.put(color, SpriteShifter.get("block/belt", "block/belt/" + id));
|
||||||
|
DYED_OFFSET_BELTS.put(color, SpriteShifter.get("block/belt_offset", "block/belt/" + id));
|
||||||
|
DYED_DIAGONAL_BELTS.put(color, SpriteShifter.get("block/belt_diagonal", "block/belt/" + id + "_diagonal"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -9,6 +9,7 @@ import com.simibubi.create.AllItems;
|
|||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.processing.EmptyingByBasin;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity.CasingType;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity.CasingType;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler.TransportedEntityInfo;
|
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler.TransportedEntityInfo;
|
||||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock;
|
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock;
|
||||||
@ -31,6 +32,8 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.MobEntity;
|
import net.minecraft.entity.MobEntity;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.DyeColor;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
@ -62,6 +65,7 @@ import net.minecraft.world.WorldType;
|
|||||||
import net.minecraft.world.storage.loot.LootParameters;
|
import net.minecraft.world.storage.loot.LootParameters;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.common.Tags;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
@ -211,8 +215,19 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
ItemStack heldItem = player.getHeldItem(handIn);
|
ItemStack heldItem = player.getHeldItem(handIn);
|
||||||
boolean isShaft = AllBlocks.SHAFT.isIn(heldItem);
|
boolean isShaft = AllBlocks.SHAFT.isIn(heldItem);
|
||||||
|
boolean isDye = Tags.Items.DYES.contains(heldItem.getItem());
|
||||||
|
boolean hasWater = EmptyingByBasin.emptyItem(world, heldItem, true)
|
||||||
|
.getFirst()
|
||||||
|
.getFluid()
|
||||||
|
.isEquivalentTo(Fluids.WATER);
|
||||||
boolean isHand = heldItem.isEmpty() && handIn == Hand.MAIN_HAND;
|
boolean isHand = heldItem.isEmpty() && handIn == Hand.MAIN_HAND;
|
||||||
|
|
||||||
|
if (isDye || hasWater) {
|
||||||
|
if (!world.isRemote)
|
||||||
|
withTileEntityDo(world, pos, te -> te.applyColor(DyeColor.getColor(heldItem)));
|
||||||
|
return ActionResultType.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
BeltTileEntity belt = BeltHelper.getSegmentTE(world, pos);
|
BeltTileEntity belt = BeltHelper.getSegmentTE(world, pos);
|
||||||
if (belt == null)
|
if (belt == null)
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
@ -413,7 +428,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||||||
return;
|
return;
|
||||||
if (isMoving)
|
if (isMoving)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
if (te instanceof BeltTileEntity) {
|
if (te instanceof BeltTileEntity) {
|
||||||
BeltTileEntity beltTileEntity = (BeltTileEntity) te;
|
BeltTileEntity beltTileEntity = (BeltTileEntity) te;
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package com.simibubi.create.content.contraptions.relays.belt;
|
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.ILightReader;
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public class BeltColor implements IBlockColor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getColor(BlockState state, ILightReader reader, BlockPos pos, int layer) {
|
|
||||||
if (reader == null)
|
|
||||||
return 0;
|
|
||||||
TileEntity tileEntity = reader.getTileEntity(pos);
|
|
||||||
if (tileEntity instanceof BeltTileEntity) {
|
|
||||||
BeltTileEntity te = (BeltTileEntity) tileEntity;
|
|
||||||
if (te.color != -1)
|
|
||||||
return te.color;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -28,6 +28,7 @@ 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.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.item.DyeColor;
|
||||||
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;
|
||||||
@ -40,7 +41,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||||||
public BeltRenderer(TileEntityRendererDispatcher dispatcher) {
|
public BeltRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
super(dispatcher);
|
super(dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGlobalRenderer(BeltTileEntity te) {
|
public boolean isGlobalRenderer(BeltTileEntity te) {
|
||||||
return BeltBlock.canTransportObjects(te.getBlockState());
|
return BeltBlock.canTransportObjects(te.getBlockState());
|
||||||
@ -97,14 +98,22 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||||||
|
|
||||||
SuperByteBuffer beltBuffer = beltPartial.renderOn(blockState)
|
SuperByteBuffer beltBuffer = beltPartial.renderOn(blockState)
|
||||||
.light(light);
|
.light(light);
|
||||||
SpriteShiftEntry spriteShift =
|
|
||||||
diagonal ? AllSpriteShifts.BELT_DIAGONAL : bottom ? AllSpriteShifts.BELT_OFFSET : AllSpriteShifts.BELT;
|
SpriteShiftEntry spriteShift = null;
|
||||||
|
if (te.color.isPresent()) {
|
||||||
|
DyeColor color = te.color.get();
|
||||||
|
spriteShift = (diagonal ? AllSpriteShifts.DYED_DIAGONAL_BELTS
|
||||||
|
: bottom ? AllSpriteShifts.DYED_OFFSET_BELTS : AllSpriteShifts.DYED_BELTS).get(color);
|
||||||
|
} else
|
||||||
|
spriteShift = diagonal ? AllSpriteShifts.BELT_DIAGONAL
|
||||||
|
: bottom ? AllSpriteShifts.BELT_OFFSET : AllSpriteShifts.BELT;
|
||||||
|
|
||||||
int cycleLength = diagonal ? 12 : 16;
|
int cycleLength = diagonal ? 12 : 16;
|
||||||
int cycleOffset = bottom ? 8 : 0;
|
int cycleOffset = bottom ? 8 : 0;
|
||||||
|
|
||||||
// UV shift
|
// UV shift
|
||||||
float speed = te.getSpeed();
|
float speed = te.getSpeed();
|
||||||
if (speed != 0) {
|
if (speed != 0 || te.color.isPresent()) {
|
||||||
float time = renderTick * axisDirection.getOffset();
|
float time = renderTick * axisDirection.getOffset();
|
||||||
if (diagonal && (downward ^ alongX) || !sideways && !diagonal && alongX
|
if (diagonal && (downward ^ alongX) || !sideways && !diagonal && alongX
|
||||||
|| sideways && axisDirection == AxisDirection.NEGATIVE)
|
|| sideways && axisDirection == AxisDirection.NEGATIVE)
|
||||||
|
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
@ -24,7 +25,6 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -54,7 +54,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||||||
public class BeltTileEntity extends KineticTileEntity {
|
public class BeltTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
public Map<Entity, TransportedEntityInfo> passengers;
|
public Map<Entity, TransportedEntityInfo> passengers;
|
||||||
public int color;
|
public Optional<DyeColor> color;
|
||||||
public int beltLength;
|
public int beltLength;
|
||||||
public int index;
|
public int index;
|
||||||
public Direction lastInsert;
|
public Direction lastInsert;
|
||||||
@ -75,7 +75,7 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||||||
controller = BlockPos.ZERO;
|
controller = BlockPos.ZERO;
|
||||||
itemHandler = LazyOptional.empty();
|
itemHandler = LazyOptional.empty();
|
||||||
casing = CasingType.NONE;
|
casing = CasingType.NONE;
|
||||||
color = -1;
|
color = Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -182,11 +182,13 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||||||
if (controller != null)
|
if (controller != null)
|
||||||
compound.put("Controller", NBTUtil.writeBlockPos(controller));
|
compound.put("Controller", NBTUtil.writeBlockPos(controller));
|
||||||
compound.putBoolean("IsController", isController());
|
compound.putBoolean("IsController", isController());
|
||||||
compound.putInt("Color", color);
|
|
||||||
compound.putInt("Length", beltLength);
|
compound.putInt("Length", beltLength);
|
||||||
compound.putInt("Index", index);
|
compound.putInt("Index", index);
|
||||||
NBTHelper.writeEnum(compound, "Casing", casing);
|
NBTHelper.writeEnum(compound, "Casing", casing);
|
||||||
|
|
||||||
|
if (color.isPresent())
|
||||||
|
NBTHelper.writeEnum(compound, "Dye", color.get());
|
||||||
|
|
||||||
if (isController())
|
if (isController())
|
||||||
compound.put("Inventory", getInventory().write());
|
compound.put("Inventory", getInventory().write());
|
||||||
super.write(compound, clientPacket);
|
super.write(compound, clientPacket);
|
||||||
@ -199,11 +201,13 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||||||
if (compound.getBoolean("IsController"))
|
if (compound.getBoolean("IsController"))
|
||||||
controller = pos;
|
controller = pos;
|
||||||
|
|
||||||
|
color = compound.contains("Dye") ? Optional.of(NBTHelper.readEnum(compound, "Dye", DyeColor.class))
|
||||||
|
: Optional.empty();
|
||||||
|
|
||||||
if (!wasMoved) {
|
if (!wasMoved) {
|
||||||
if (!isController())
|
if (!isController())
|
||||||
controller = NBTUtil.readBlockPos(compound.getCompound("Controller"));
|
controller = NBTUtil.readBlockPos(compound.getCompound("Controller"));
|
||||||
trackerUpdateTag = compound;
|
trackerUpdateTag = compound;
|
||||||
color = compound.getInt("Color");
|
|
||||||
beltLength = compound.getInt("Length");
|
beltLength = compound.getInt("Length");
|
||||||
index = compound.getInt("Index");
|
index = compound.getInt("Index");
|
||||||
}
|
}
|
||||||
@ -233,12 +237,17 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void applyColor(DyeColor colorIn) {
|
public void applyColor(DyeColor colorIn) {
|
||||||
int colorValue = colorIn.getMapColor().colorValue;
|
if (colorIn == null) {
|
||||||
|
if (!color.isPresent())
|
||||||
|
return;
|
||||||
|
} else if (color.isPresent() && color.get() == colorIn)
|
||||||
|
return;
|
||||||
|
|
||||||
for (BlockPos blockPos : BeltBlock.getBeltChain(world, getController())) {
|
for (BlockPos blockPos : BeltBlock.getBeltChain(world, getController())) {
|
||||||
BeltTileEntity belt = BeltHelper.getSegmentTE(world, blockPos);
|
BeltTileEntity belt = BeltHelper.getSegmentTE(world, blockPos);
|
||||||
if (belt == null)
|
if (belt == null)
|
||||||
continue;
|
continue;
|
||||||
belt.color = belt.color == -1 ? colorValue : ColorHelper.mixColors(belt.color, colorValue, .5f);
|
belt.color = Optional.ofNullable(colorIn);
|
||||||
belt.markDirty();
|
belt.markDirty();
|
||||||
belt.sendData();
|
belt.sendData();
|
||||||
}
|
}
|
||||||
|
BIN
src/main/resources/assets/create/textures/block/belt/black.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/blue.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/brown.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/cyan.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/gray.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/green.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/lime.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/magenta.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/orange.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/pink.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/purple.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/red.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/white.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
src/main/resources/assets/create/textures/block/belt/yellow.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |