mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Prevent loading connected textures on server
- Wrap ConnectedTextureBehaviour and AllSpriteShifts instances in Suppliers where necessary - Use client connection's instead of level's RecipeManager when finding recipes for JEI - Add missing override annotations in SymmetryEffectPacket - Organize imports
This commit is contained in:
parent
1bae455045
commit
cf3dac6ad0
26 changed files with 156 additions and 183 deletions
|
@ -294,20 +294,20 @@ public class AllBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<EncasedShaftBlock> ANDESITE_ENCASED_SHAFT =
|
public static final BlockEntry<EncasedShaftBlock> ANDESITE_ENCASED_SHAFT =
|
||||||
REGISTRATE.block("andesite_encased_shaft", EncasedShaftBlock::andesite)
|
REGISTRATE.block("andesite_encased_shaft", EncasedShaftBlock::andesite)
|
||||||
.transform(BuilderTransformers.encasedShaft("andesite", AllSpriteShifts.ANDESITE_CASING))
|
.transform(BuilderTransformers.encasedShaft("andesite", () -> AllSpriteShifts.ANDESITE_CASING))
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<EncasedShaftBlock> BRASS_ENCASED_SHAFT =
|
public static final BlockEntry<EncasedShaftBlock> BRASS_ENCASED_SHAFT =
|
||||||
REGISTRATE.block("brass_encased_shaft", EncasedShaftBlock::brass)
|
REGISTRATE.block("brass_encased_shaft", EncasedShaftBlock::brass)
|
||||||
.transform(BuilderTransformers.encasedShaft("brass", AllSpriteShifts.BRASS_CASING))
|
.transform(BuilderTransformers.encasedShaft("brass", () -> AllSpriteShifts.BRASS_CASING))
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<EncasedCogwheelBlock> ANDESITE_ENCASED_COGWHEEL =
|
public static final BlockEntry<EncasedCogwheelBlock> ANDESITE_ENCASED_COGWHEEL =
|
||||||
REGISTRATE.block("andesite_encased_cogwheel", p -> EncasedCogwheelBlock.andesite(false, p))
|
REGISTRATE.block("andesite_encased_cogwheel", p -> EncasedCogwheelBlock.andesite(false, p))
|
||||||
.transform(BuilderTransformers.encasedCogwheel("andesite", AllSpriteShifts.ANDESITE_CASING))
|
.transform(BuilderTransformers.encasedCogwheel("andesite", () -> AllSpriteShifts.ANDESITE_CASING))
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new EncasedCogCTBehaviour(AllSpriteShifts.ANDESITE_CASING,
|
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCogCTBehaviour(AllSpriteShifts.ANDESITE_CASING,
|
||||||
Couple.create(AllSpriteShifts.ANDESITE_ENCASED_COGWHEEL_SIDE,
|
Couple.create(AllSpriteShifts.ANDESITE_ENCASED_COGWHEEL_SIDE,
|
||||||
AllSpriteShifts.ANDESITE_ENCASED_COGWHEEL_OTHERSIDE))))
|
AllSpriteShifts.ANDESITE_ENCASED_COGWHEEL_OTHERSIDE))))
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
|
@ -315,8 +315,8 @@ public class AllBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<EncasedCogwheelBlock> BRASS_ENCASED_COGWHEEL =
|
public static final BlockEntry<EncasedCogwheelBlock> BRASS_ENCASED_COGWHEEL =
|
||||||
REGISTRATE.block("brass_encased_cogwheel", p -> EncasedCogwheelBlock.brass(false, p))
|
REGISTRATE.block("brass_encased_cogwheel", p -> EncasedCogwheelBlock.brass(false, p))
|
||||||
.transform(BuilderTransformers.encasedCogwheel("brass", AllSpriteShifts.BRASS_CASING))
|
.transform(BuilderTransformers.encasedCogwheel("brass", () -> AllSpriteShifts.BRASS_CASING))
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new EncasedCogCTBehaviour(AllSpriteShifts.BRASS_CASING,
|
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCogCTBehaviour(AllSpriteShifts.BRASS_CASING,
|
||||||
Couple.create(AllSpriteShifts.BRASS_ENCASED_COGWHEEL_SIDE,
|
Couple.create(AllSpriteShifts.BRASS_ENCASED_COGWHEEL_SIDE,
|
||||||
AllSpriteShifts.BRASS_ENCASED_COGWHEEL_OTHERSIDE))))
|
AllSpriteShifts.BRASS_ENCASED_COGWHEEL_OTHERSIDE))))
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
|
@ -324,13 +324,13 @@ public class AllBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<EncasedCogwheelBlock> ANDESITE_ENCASED_LARGE_COGWHEEL =
|
public static final BlockEntry<EncasedCogwheelBlock> ANDESITE_ENCASED_LARGE_COGWHEEL =
|
||||||
REGISTRATE.block("andesite_encased_large_cogwheel", p -> EncasedCogwheelBlock.andesite(true, p))
|
REGISTRATE.block("andesite_encased_large_cogwheel", p -> EncasedCogwheelBlock.andesite(true, p))
|
||||||
.transform(BuilderTransformers.encasedLargeCogwheel("andesite", AllSpriteShifts.ANDESITE_CASING))
|
.transform(BuilderTransformers.encasedLargeCogwheel("andesite", () -> AllSpriteShifts.ANDESITE_CASING))
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<EncasedCogwheelBlock> BRASS_ENCASED_LARGE_COGWHEEL =
|
public static final BlockEntry<EncasedCogwheelBlock> BRASS_ENCASED_LARGE_COGWHEEL =
|
||||||
REGISTRATE.block("brass_encased_large_cogwheel", p -> EncasedCogwheelBlock.brass(true, p))
|
REGISTRATE.block("brass_encased_large_cogwheel", p -> EncasedCogwheelBlock.brass(true, p))
|
||||||
.transform(BuilderTransformers.encasedLargeCogwheel("brass", AllSpriteShifts.BRASS_CASING))
|
.transform(BuilderTransformers.encasedLargeCogwheel("brass", () -> AllSpriteShifts.BRASS_CASING))
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ public class AllBlocks {
|
||||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||||
.transform(BlockStressDefaults.setNoImpact())
|
.transform(BlockStressDefaults.setNoImpact())
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING)))
|
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING)))
|
||||||
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING,
|
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING,
|
||||||
(s, f) -> f.getAxis() == s.getValue(GearboxBlock.AXIS))))
|
(s, f) -> f.getAxis() == s.getValue(GearboxBlock.AXIS))))
|
||||||
.blockstate((c, p) -> axisBlock(c, p, $ -> AssetLookup.partialBaseModel(c, p), true))
|
.blockstate((c, p) -> axisBlock(c, p, $ -> AssetLookup.partialBaseModel(c, p), true))
|
||||||
|
@ -668,7 +668,7 @@ public class AllBlocks {
|
||||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.blockstate(BlockStateGen.encasedPipe())
|
.blockstate(BlockStateGen.encasedPipe())
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
|
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
|
||||||
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING,
|
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING,
|
||||||
(s, f) -> !s.getValue(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f)))))
|
(s, f) -> !s.getValue(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f)))))
|
||||||
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
|
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
|
||||||
|
@ -962,7 +962,7 @@ public class AllBlocks {
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.tag(AllBlockTags.SAFE_NBT.tag)
|
.tag(AllBlockTags.SAFE_NBT.tag)
|
||||||
.blockstate(BlockStateGen.linearChassis())
|
.blockstate(BlockStateGen.linearChassis())
|
||||||
.onRegister(connectedTextures(new ChassisCTBehaviour()))
|
.onRegister(connectedTextures(ChassisCTBehaviour::new))
|
||||||
.lang("Linear Chassis")
|
.lang("Linear Chassis")
|
||||||
.simpleItem()
|
.simpleItem()
|
||||||
.register();
|
.register();
|
||||||
|
@ -973,7 +973,7 @@ public class AllBlocks {
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.tag(AllBlockTags.SAFE_NBT.tag)
|
.tag(AllBlockTags.SAFE_NBT.tag)
|
||||||
.blockstate(BlockStateGen.linearChassis())
|
.blockstate(BlockStateGen.linearChassis())
|
||||||
.onRegister(connectedTextures(new ChassisCTBehaviour()))
|
.onRegister(connectedTextures(ChassisCTBehaviour::new))
|
||||||
.simpleItem()
|
.simpleItem()
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
@ -1146,27 +1146,27 @@ public class AllBlocks {
|
||||||
});
|
});
|
||||||
|
|
||||||
public static final BlockEntry<CasingBlock> ANDESITE_CASING = REGISTRATE.block("andesite_casing", CasingBlock::new)
|
public static final BlockEntry<CasingBlock> ANDESITE_CASING = REGISTRATE.block("andesite_casing", CasingBlock::new)
|
||||||
.transform(BuilderTransformers.casing(AllSpriteShifts.ANDESITE_CASING))
|
.transform(BuilderTransformers.casing(() -> AllSpriteShifts.ANDESITE_CASING))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<CasingBlock> BRASS_CASING = REGISTRATE.block("brass_casing", CasingBlock::new)
|
public static final BlockEntry<CasingBlock> BRASS_CASING = REGISTRATE.block("brass_casing", CasingBlock::new)
|
||||||
.transform(BuilderTransformers.casing(AllSpriteShifts.BRASS_CASING))
|
.transform(BuilderTransformers.casing(() -> AllSpriteShifts.BRASS_CASING))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<CasingBlock> COPPER_CASING = REGISTRATE.block("copper_casing", CasingBlock::new)
|
public static final BlockEntry<CasingBlock> COPPER_CASING = REGISTRATE.block("copper_casing", CasingBlock::new)
|
||||||
.transform(BuilderTransformers.casing(AllSpriteShifts.COPPER_CASING))
|
.transform(BuilderTransformers.casing(() -> AllSpriteShifts.COPPER_CASING))
|
||||||
.properties(p -> p.sound(SoundType.COPPER))
|
.properties(p -> p.sound(SoundType.COPPER))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<CasingBlock> SHADOW_STEEL_CASING =
|
public static final BlockEntry<CasingBlock> SHADOW_STEEL_CASING =
|
||||||
REGISTRATE.block("shadow_steel_casing", CasingBlock::deprecated)
|
REGISTRATE.block("shadow_steel_casing", CasingBlock::deprecated)
|
||||||
.transform(BuilderTransformers.casing(AllSpriteShifts.SHADOW_STEEL_CASING))
|
.transform(BuilderTransformers.casing(() -> AllSpriteShifts.SHADOW_STEEL_CASING))
|
||||||
.lang("Shadow Casing")
|
.lang("Shadow Casing")
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<CasingBlock> REFINED_RADIANCE_CASING =
|
public static final BlockEntry<CasingBlock> REFINED_RADIANCE_CASING =
|
||||||
REGISTRATE.block("refined_radiance_casing", CasingBlock::deprecated)
|
REGISTRATE.block("refined_radiance_casing", CasingBlock::deprecated)
|
||||||
.transform(BuilderTransformers.casing(AllSpriteShifts.REFINED_RADIANCE_CASING))
|
.transform(BuilderTransformers.casing(() -> AllSpriteShifts.REFINED_RADIANCE_CASING))
|
||||||
.properties(p -> p.lightLevel($ -> 12))
|
.properties(p -> p.lightLevel($ -> 12))
|
||||||
.lang("Radiant Casing")
|
.lang("Radiant Casing")
|
||||||
.register();
|
.register();
|
||||||
|
@ -1178,7 +1178,7 @@ public class AllBlocks {
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
||||||
.transform(BlockStressDefaults.setImpact(2.0))
|
.transform(BlockStressDefaults.setImpact(2.0))
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour()))
|
.onRegister(CreateRegistrate.connectedTextures(CrafterCTBehaviour::new))
|
||||||
.addLayer(() -> RenderType::cutoutMipped)
|
.addLayer(() -> RenderType::cutoutMipped)
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
|
@ -1257,7 +1257,7 @@ public class AllBlocks {
|
||||||
.modelFile(AssetLookup.standardModel(c, p))
|
.modelFile(AssetLookup.standardModel(c, p))
|
||||||
.rotationY(s.getValue(ItemVaultBlock.HORIZONTAL_AXIS) == Axis.X ? 90 : 0)
|
.rotationY(s.getValue(ItemVaultBlock.HORIZONTAL_AXIS) == Axis.X ? 90 : 0)
|
||||||
.build()))
|
.build()))
|
||||||
.onRegister(connectedTextures(new ItemVaultCTBehaviour()))
|
.onRegister(connectedTextures(ItemVaultCTBehaviour::new))
|
||||||
.item(ItemVaultItem::new)
|
.item(ItemVaultItem::new)
|
||||||
.build()
|
.build()
|
||||||
.register();
|
.register();
|
||||||
|
@ -1312,7 +1312,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<BrassTunnelBlock> BRASS_TUNNEL =
|
public static final BlockEntry<BrassTunnelBlock> BRASS_TUNNEL =
|
||||||
REGISTRATE.block("brass_tunnel", BrassTunnelBlock::new)
|
REGISTRATE.block("brass_tunnel", BrassTunnelBlock::new)
|
||||||
.transform(BuilderTransformers.beltTunnel("brass", Create.asResource("block/brass_block")))
|
.transform(BuilderTransformers.beltTunnel("brass", Create.asResource("block/brass_block")))
|
||||||
.onRegister(connectedTextures(new BrassTunnelCTBehaviour()))
|
.onRegister(connectedTextures(BrassTunnelCTBehaviour::new))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<ContentObserverBlock> CONTENT_OBSERVER =
|
public static final BlockEntry<ContentObserverBlock> CONTENT_OBSERVER =
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.IdentityHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||||
import com.simibubi.create.foundation.block.connected.CTSpriteShifter;
|
|
||||||
import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType;
|
import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType;
|
||||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||||
|
@ -21,7 +20,7 @@ import net.minecraft.world.level.block.state.properties.WoodType;
|
||||||
|
|
||||||
public class AllSpriteShifts {
|
public class AllSpriteShifts {
|
||||||
|
|
||||||
static final Map<WoodType, CTSpriteShiftEntry> WOODEN_WINDOWS = new IdentityHashMap<>();
|
private static final Map<WoodType, CTSpriteShiftEntry> WOODEN_WINDOWS = new IdentityHashMap<>();
|
||||||
|
|
||||||
public static final Map<DyeColor, SpriteShiftEntry> DYED_BELTS = new IdentityHashMap<>(),
|
public static final Map<DyeColor, SpriteShiftEntry> DYED_BELTS = new IdentityHashMap<>(),
|
||||||
DYED_OFFSET_BELTS = new IdentityHashMap<>(), DYED_DIAGONAL_BELTS = new IdentityHashMap<>();
|
DYED_OFFSET_BELTS = new IdentityHashMap<>(), DYED_DIAGONAL_BELTS = new IdentityHashMap<>();
|
||||||
|
@ -33,22 +32,22 @@ public class AllSpriteShifts {
|
||||||
ORNATE_IRON_WINDOW = vertical("palettes/ornate_iron_window");
|
ORNATE_IRON_WINDOW = vertical("palettes/ornate_iron_window");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry CRAFTER_FRONT = getCT(CTType.OMNIDIRECTIONAL, "crafter_top", "brass_casing"),
|
public static final CTSpriteShiftEntry CRAFTER_FRONT = getCT(CTType.OMNIDIRECTIONAL, "crafter_top", "brass_casing"),
|
||||||
CRAFTER_SIDE = getCT(CTType.VERTICAL, "crafter_side"),
|
CRAFTER_SIDE = vertical("crafter_side"),
|
||||||
CRAFTER_OTHERSIDE = getCT(CTType.HORIZONTAL, "crafter_side"),
|
CRAFTER_OTHERSIDE = horizontal("crafter_side"),
|
||||||
ANDESITE_ENCASED_COGWHEEL_SIDE = getCT(CTType.VERTICAL, "andesite_encased_cogwheel_side"),
|
ANDESITE_ENCASED_COGWHEEL_SIDE = vertical("andesite_encased_cogwheel_side"),
|
||||||
ANDESITE_ENCASED_COGWHEEL_OTHERSIDE = getCT(CTType.HORIZONTAL, "andesite_encased_cogwheel_side"),
|
ANDESITE_ENCASED_COGWHEEL_OTHERSIDE = horizontal("andesite_encased_cogwheel_side"),
|
||||||
BRASS_ENCASED_COGWHEEL_SIDE = getCT(CTType.VERTICAL, "brass_encased_cogwheel_side"),
|
BRASS_ENCASED_COGWHEEL_SIDE = vertical("brass_encased_cogwheel_side"),
|
||||||
BRASS_ENCASED_COGWHEEL_OTHERSIDE = getCT(CTType.HORIZONTAL, "brass_encased_cogwheel_side");
|
BRASS_ENCASED_COGWHEEL_OTHERSIDE = horizontal("brass_encased_cogwheel_side");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry ANDESITE_CASING = omni("andesite_casing"),
|
public static final CTSpriteShiftEntry ANDESITE_CASING = omni("andesite_casing"),
|
||||||
BRASS_CASING = omni("brass_casing"), COPPER_CASING = omni("copper_casing"),
|
BRASS_CASING = omni("brass_casing"), COPPER_CASING = omni("copper_casing"),
|
||||||
SHADOW_STEEL_CASING = omni("shadow_steel_casing"), REFINED_RADIANCE_CASING = omni("refined_radiance_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 CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_side"),
|
public static final CTSpriteShiftEntry CHASSIS_SIDE = omni("linear_chassis_side"),
|
||||||
SECONDARY_CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "secondary_linear_chassis_side"),
|
SECONDARY_CHASSIS_SIDE = omni("secondary_linear_chassis_side"),
|
||||||
CHASSIS = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end"),
|
CHASSIS = omni("linear_chassis_end"),
|
||||||
CHASSIS_STICKY = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end_sticky");
|
CHASSIS_STICKY = omni("linear_chassis_end_sticky");
|
||||||
|
|
||||||
public static final CTSpriteShiftEntry BRASS_TUNNEL_TOP = vertical("brass_tunnel_top"),
|
public static final CTSpriteShiftEntry BRASS_TUNNEL_TOP = vertical("brass_tunnel_top"),
|
||||||
FLUID_TANK = getCT(CTType.CROSS, "fluid_tank"),
|
FLUID_TANK = getCT(CTType.CROSS, "fluid_tank"),
|
||||||
|
@ -67,14 +66,6 @@ public class AllSpriteShifts {
|
||||||
populateMaps();
|
populateMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
public static CTSpriteShiftEntry getWoodenWindow(WoodType woodType) {
|
|
||||||
return WOODEN_WINDOWS.get(woodType);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
private static void populateMaps() {
|
private static void populateMaps() {
|
||||||
WoodType[] supportedWoodTypes = new WoodType[] { WoodType.OAK, WoodType.SPRUCE, WoodType.BIRCH, WoodType.ACACIA,
|
WoodType[] supportedWoodTypes = new WoodType[] { WoodType.OAK, WoodType.SPRUCE, WoodType.BIRCH, WoodType.ACACIA,
|
||||||
WoodType.JUNGLE, WoodType.DARK_OAK, WoodType.CRIMSON, WoodType.WARPED };
|
WoodType.JUNGLE, WoodType.DARK_OAK, WoodType.CRIMSON, WoodType.WARPED };
|
||||||
|
@ -90,24 +81,30 @@ public class AllSpriteShifts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Couple<CTSpriteShiftEntry> vault(String name) {
|
private static Couple<CTSpriteShiftEntry> vault(String name) {
|
||||||
final String prefixed = "vault_" + name;
|
final String prefixed = "vault_" + name;
|
||||||
return Couple
|
return Couple
|
||||||
.createWithContext(b -> getCT(CTSpriteShifter.CTType.CROSS, prefixed, b ? prefixed : prefixed + "_large"));
|
.createWithContext(b -> getCT(CTType.CROSS, prefixed, b ? prefixed : prefixed + "_large"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
static CTSpriteShiftEntry omni(String name) {
|
private static CTSpriteShiftEntry omni(String name) {
|
||||||
return getCT(OMNIDIRECTIONAL, name);
|
return getCT(OMNIDIRECTIONAL, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CTSpriteShiftEntry vertical(String name) {
|
private static CTSpriteShiftEntry horizontal(String name) {
|
||||||
return getCT(VERTICAL, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CTSpriteShiftEntry horizontal(String name) {
|
|
||||||
return getCT(HORIZONTAL, name);
|
return getCT(HORIZONTAL, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static CTSpriteShiftEntry vertical(String name) {
|
||||||
|
return getCT(VERTICAL, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
public static CTSpriteShiftEntry getWoodenWindow(WoodType woodType) {
|
||||||
|
return WOODEN_WINDOWS.get(woodType);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import com.simibubi.create.foundation.data.recipe.ProcessingRecipeGen;
|
||||||
import com.simibubi.create.foundation.data.recipe.SequencedAssemblyRecipeGen;
|
import com.simibubi.create.foundation.data.recipe.SequencedAssemblyRecipeGen;
|
||||||
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.ShippedResourcePacks;
|
|
||||||
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
||||||
import com.tterrag.registrate.util.NonNullLazyValue;
|
import com.tterrag.registrate.util.NonNullLazyValue;
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,7 @@ public class CreateJEI implements IModPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Recipe<?>> findRecipes(Predicate<Recipe<?>> predicate) {
|
public static List<Recipe<?>> findRecipes(Predicate<Recipe<?>> predicate) {
|
||||||
return Minecraft.getInstance().level.getRecipeManager()
|
return Minecraft.getInstance().getConnection().getRecipeManager()
|
||||||
.getRecipes()
|
.getRecipes()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(predicate)
|
.filter(predicate)
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
||||||
import com.jozufozu.flywheel.api.struct.Batched;
|
import com.jozufozu.flywheel.api.struct.Batched;
|
||||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||||
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||||
|
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
||||||
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
||||||
import com.jozufozu.flywheel.util.RenderMath;
|
import com.jozufozu.flywheel.util.RenderMath;
|
||||||
import com.mojang.math.Quaternion;
|
import com.mojang.math.Quaternion;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
||||||
import com.jozufozu.flywheel.api.struct.Batched;
|
import com.jozufozu.flywheel.api.struct.Batched;
|
||||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||||
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||||
|
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
||||||
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
||||||
import com.jozufozu.flywheel.util.RenderMath;
|
import com.jozufozu.flywheel.util.RenderMath;
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata;
|
||||||
import com.jozufozu.flywheel.api.struct.Batched;
|
import com.jozufozu.flywheel.api.struct.Batched;
|
||||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||||
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||||
|
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
||||||
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
||||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.light.GPULightVolume;
|
import com.jozufozu.flywheel.light.GPULightVolume;
|
||||||
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
|
||||||
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
|
||||||
import com.jozufozu.flywheel.light.LightListener;
|
import com.jozufozu.flywheel.light.LightListener;
|
||||||
import com.jozufozu.flywheel.light.LightProvider;
|
import com.jozufozu.flywheel.light.LightProvider;
|
||||||
import com.jozufozu.flywheel.light.LightUpdater;
|
import com.jozufozu.flywheel.light.LightUpdater;
|
||||||
import com.jozufozu.flywheel.light.ListenerStatus;
|
import com.jozufozu.flywheel.light.ListenerStatus;
|
||||||
|
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
||||||
|
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
||||||
|
|
||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
|
||||||
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
|
||||||
import com.jozufozu.flywheel.light.LightProvider;
|
import com.jozufozu.flywheel.light.LightProvider;
|
||||||
import com.jozufozu.flywheel.light.MovingListener;
|
import com.jozufozu.flywheel.light.MovingListener;
|
||||||
|
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
||||||
|
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
|
||||||
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements MovingListener {
|
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements MovingListener {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement.glue;
|
package com.simibubi.create.content.contraptions.components.structureMovement.glue;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.api.vertex.VertexList;
|
||||||
import com.jozufozu.flywheel.core.Formats;
|
import com.jozufozu.flywheel.core.Formats;
|
||||||
import com.jozufozu.flywheel.core.model.Model;
|
import com.jozufozu.flywheel.core.model.Model;
|
||||||
import com.jozufozu.flywheel.core.vertex.PosTexNormalWriterUnsafe;
|
import com.jozufozu.flywheel.core.vertex.PosTexNormalWriterUnsafe;
|
||||||
import com.jozufozu.flywheel.api.vertex.VertexList;
|
|
||||||
import com.mojang.blaze3d.platform.MemoryTracker;
|
import com.mojang.blaze3d.platform.MemoryTracker;
|
||||||
import com.simibubi.create.AllStitchedTextures;
|
import com.simibubi.create.AllStitchedTextures;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
|
@ -7,13 +7,13 @@ import com.jozufozu.flywheel.core.instancing.ConditionalInstance;
|
||||||
import com.jozufozu.flywheel.core.instancing.GroupInstance;
|
import com.jozufozu.flywheel.core.instancing.GroupInstance;
|
||||||
import com.jozufozu.flywheel.core.instancing.SelectInstance;
|
import com.jozufozu.flywheel.core.instancing.SelectInstance;
|
||||||
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
|
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
|
||||||
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
|
||||||
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
|
||||||
import com.jozufozu.flywheel.light.LightPacking;
|
import com.jozufozu.flywheel.light.LightPacking;
|
||||||
import com.jozufozu.flywheel.light.LightProvider;
|
import com.jozufozu.flywheel.light.LightProvider;
|
||||||
import com.jozufozu.flywheel.light.LightUpdater;
|
import com.jozufozu.flywheel.light.LightUpdater;
|
||||||
import com.jozufozu.flywheel.light.LightVolume;
|
import com.jozufozu.flywheel.light.LightVolume;
|
||||||
import com.jozufozu.flywheel.light.MovingListener;
|
import com.jozufozu.flywheel.light.MovingListener;
|
||||||
|
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
||||||
|
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
|
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
|
||||||
|
|
|
@ -13,12 +13,12 @@ import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher;
|
import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher;
|
||||||
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
|
||||||
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
|
||||||
import com.jozufozu.flywheel.light.LightListener;
|
import com.jozufozu.flywheel.light.LightListener;
|
||||||
import com.jozufozu.flywheel.light.LightProvider;
|
import com.jozufozu.flywheel.light.LightProvider;
|
||||||
import com.jozufozu.flywheel.light.LightUpdater;
|
import com.jozufozu.flywheel.light.LightUpdater;
|
||||||
import com.jozufozu.flywheel.light.ListenerStatus;
|
import com.jozufozu.flywheel.light.ListenerStatus;
|
||||||
|
import com.jozufozu.flywheel.util.box.GridAlignedBB;
|
||||||
|
import com.jozufozu.flywheel.util.box.ImmutableBox;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class SymmetryEffectPacket extends SimplePacketBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void write(FriendlyByteBuf buffer) {
|
public void write(FriendlyByteBuf buffer) {
|
||||||
buffer.writeBlockPos(mirror);
|
buffer.writeBlockPos(mirror);
|
||||||
buffer.writeInt(positions.size());
|
buffer.writeInt(positions.size());
|
||||||
|
@ -41,6 +42,7 @@ public class SymmetryEffectPacket extends SimplePacketBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void handle(Supplier<Context> ctx) {
|
public void handle(Supplier<Context> ctx) {
|
||||||
ctx.get().enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
ctx.get().enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
if (Minecraft.getInstance().player.position().distanceTo(Vec3.atLowerCornerOf(mirror)) > 100)
|
if (Minecraft.getInstance().player.position().distanceTo(Vec3.atLowerCornerOf(mirror)) > 100)
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.simibubi.create.content.curiosities.toolbox;
|
package com.simibubi.create.content.curiosities.toolbox;
|
||||||
|
|
||||||
import net.minecraft.world.Container;
|
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
|
||||||
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,8 +7,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import com.simibubi.create.AllEntityTypes;
|
import com.simibubi.create.AllEntityTypes;
|
||||||
|
@ -28,6 +26,7 @@ import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Direction.Axis;
|
import net.minecraft.core.Direction.Axis;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.simibubi.create.content.logistics.block.flap;
|
||||||
import com.jozufozu.flywheel.api.struct.Batched;
|
import com.jozufozu.flywheel.api.struct.Batched;
|
||||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||||
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||||
|
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
||||||
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
import com.jozufozu.flywheel.core.model.ModelTransformer;
|
||||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||||
|
|
|
@ -47,22 +47,22 @@ public class AllPaletteBlocks {
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<ConnectedGlassBlock> FRAMED_GLASS =
|
public static final BlockEntry<ConnectedGlassBlock> FRAMED_GLASS =
|
||||||
framedGlass("framed_glass", new StandardCTBehaviour(AllSpriteShifts.FRAMED_GLASS)),
|
framedGlass("framed_glass", () -> new StandardCTBehaviour(AllSpriteShifts.FRAMED_GLASS)),
|
||||||
HORIZONTAL_FRAMED_GLASS = framedGlass("horizontal_framed_glass",
|
HORIZONTAL_FRAMED_GLASS = framedGlass("horizontal_framed_glass",
|
||||||
new HorizontalCTBehaviour(AllSpriteShifts.HORIZONTAL_FRAMED_GLASS, AllSpriteShifts.FRAMED_GLASS)),
|
() -> new HorizontalCTBehaviour(AllSpriteShifts.HORIZONTAL_FRAMED_GLASS, AllSpriteShifts.FRAMED_GLASS)),
|
||||||
VERTICAL_FRAMED_GLASS =
|
VERTICAL_FRAMED_GLASS =
|
||||||
framedGlass("vertical_framed_glass", new HorizontalCTBehaviour(AllSpriteShifts.VERTICAL_FRAMED_GLASS));
|
framedGlass("vertical_framed_glass", () -> new HorizontalCTBehaviour(AllSpriteShifts.VERTICAL_FRAMED_GLASS));
|
||||||
|
|
||||||
public static final BlockEntry<GlassPaneBlock> TILED_GLASS_PANE =
|
public static final BlockEntry<GlassPaneBlock> TILED_GLASS_PANE =
|
||||||
WindowGen.standardGlassPane("tiled_glass", TILED_GLASS, Create.asResource("block/palettes/tiled_glass"),
|
WindowGen.standardGlassPane("tiled_glass", TILED_GLASS, Create.asResource("block/palettes/tiled_glass"),
|
||||||
new ResourceLocation("block/glass_pane_top"), () -> RenderType::cutoutMipped);
|
new ResourceLocation("block/glass_pane_top"), () -> RenderType::cutoutMipped);
|
||||||
|
|
||||||
public static final BlockEntry<ConnectedGlassPaneBlock> FRAMED_GLASS_PANE =
|
public static final BlockEntry<ConnectedGlassPaneBlock> FRAMED_GLASS_PANE =
|
||||||
framedGlassPane("framed_glass", FRAMED_GLASS, AllSpriteShifts.FRAMED_GLASS),
|
framedGlassPane("framed_glass", FRAMED_GLASS, () -> AllSpriteShifts.FRAMED_GLASS),
|
||||||
HORIZONTAL_FRAMED_GLASS_PANE = framedGlassPane("horizontal_framed_glass", HORIZONTAL_FRAMED_GLASS,
|
HORIZONTAL_FRAMED_GLASS_PANE = framedGlassPane("horizontal_framed_glass", HORIZONTAL_FRAMED_GLASS,
|
||||||
AllSpriteShifts.HORIZONTAL_FRAMED_GLASS),
|
() -> AllSpriteShifts.HORIZONTAL_FRAMED_GLASS),
|
||||||
VERTICAL_FRAMED_GLASS_PANE =
|
VERTICAL_FRAMED_GLASS_PANE =
|
||||||
framedGlassPane("vertical_framed_glass", VERTICAL_FRAMED_GLASS, AllSpriteShifts.VERTICAL_FRAMED_GLASS);
|
framedGlassPane("vertical_framed_glass", VERTICAL_FRAMED_GLASS, () -> AllSpriteShifts.VERTICAL_FRAMED_GLASS);
|
||||||
|
|
||||||
public static final BlockEntry<WindowBlock> OAK_WINDOW = woodenWindowBlock(WoodType.OAK, Blocks.OAK_PLANKS),
|
public static final BlockEntry<WindowBlock> OAK_WINDOW = woodenWindowBlock(WoodType.OAK, Blocks.OAK_PLANKS),
|
||||||
SPRUCE_WINDOW = woodenWindowBlock(WoodType.SPRUCE, Blocks.SPRUCE_PLANKS),
|
SPRUCE_WINDOW = woodenWindowBlock(WoodType.SPRUCE, Blocks.SPRUCE_PLANKS),
|
||||||
|
@ -73,7 +73,7 @@ public class AllPaletteBlocks {
|
||||||
CRIMSON_WINDOW = woodenWindowBlock(WoodType.CRIMSON, Blocks.CRIMSON_PLANKS),
|
CRIMSON_WINDOW = woodenWindowBlock(WoodType.CRIMSON, Blocks.CRIMSON_PLANKS),
|
||||||
WARPED_WINDOW = woodenWindowBlock(WoodType.WARPED, Blocks.WARPED_PLANKS),
|
WARPED_WINDOW = woodenWindowBlock(WoodType.WARPED, Blocks.WARPED_PLANKS),
|
||||||
ORNATE_IRON_WINDOW = customWindowBlock("ornate_iron_window", AllItems.ANDESITE_ALLOY,
|
ORNATE_IRON_WINDOW = customWindowBlock("ornate_iron_window", AllItems.ANDESITE_ALLOY,
|
||||||
AllSpriteShifts.ORNATE_IRON_WINDOW, () -> RenderType::cutoutMipped);
|
() -> AllSpriteShifts.ORNATE_IRON_WINDOW, () -> RenderType::cutoutMipped);
|
||||||
|
|
||||||
public static final BlockEntry<ConnectedGlassPaneBlock> OAK_WINDOW_PANE =
|
public static final BlockEntry<ConnectedGlassPaneBlock> OAK_WINDOW_PANE =
|
||||||
woodenWindowPane(WoodType.OAK, OAK_WINDOW),
|
woodenWindowPane(WoodType.OAK, OAK_WINDOW),
|
||||||
|
@ -85,7 +85,7 @@ public class AllPaletteBlocks {
|
||||||
CRIMSON_WINDOW_PANE = woodenWindowPane(WoodType.CRIMSON, CRIMSON_WINDOW),
|
CRIMSON_WINDOW_PANE = woodenWindowPane(WoodType.CRIMSON, CRIMSON_WINDOW),
|
||||||
WARPED_WINDOW_PANE = woodenWindowPane(WoodType.WARPED, WARPED_WINDOW),
|
WARPED_WINDOW_PANE = woodenWindowPane(WoodType.WARPED, WARPED_WINDOW),
|
||||||
ORNATE_IRON_WINDOW_PANE = customWindowPane("ornate_iron_window", ORNATE_IRON_WINDOW,
|
ORNATE_IRON_WINDOW_PANE = customWindowPane("ornate_iron_window", ORNATE_IRON_WINDOW,
|
||||||
AllSpriteShifts.ORNATE_IRON_WINDOW, () -> RenderType::cutoutMipped);
|
() -> AllSpriteShifts.ORNATE_IRON_WINDOW, () -> RenderType::cutoutMipped);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
AllPaletteStoneTypes.register(REGISTRATE);
|
AllPaletteStoneTypes.register(REGISTRATE);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.palettes;
|
package com.simibubi.create.content.palettes;
|
||||||
|
|
||||||
|
import static com.simibubi.create.AllTags.pickaxeOnly;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -31,8 +33,6 @@ import net.minecraft.world.level.block.WallBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
||||||
import net.minecraftforge.client.model.generators.ModelFile;
|
import net.minecraftforge.client.model.generators.ModelFile;
|
||||||
|
|
||||||
import static com.simibubi.create.AllTags.pickaxeOnly;
|
|
||||||
|
|
||||||
public abstract class PaletteBlockPartial<B extends Block> {
|
public abstract class PaletteBlockPartial<B extends Block> {
|
||||||
|
|
||||||
public static final PaletteBlockPartial<StairBlock> STAIR = new Stairs();
|
public static final PaletteBlockPartial<StairBlock> STAIR = new Stairs();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import static com.simibubi.create.content.palettes.PaletteBlockPattern.PatternNa
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||||
|
@ -132,8 +133,8 @@ public class PaletteBlockPattern {
|
||||||
.accept(c, p);
|
.accept(c, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<ConnectedTextureBehaviour> createCTBehaviour(String variant) {
|
public Optional<Supplier<ConnectedTextureBehaviour>> createCTBehaviour(String variant) {
|
||||||
return ctFactory.map(d -> d.apply(variant));
|
return ctFactory.map(d -> () -> d.apply(variant));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builder
|
// Builder
|
||||||
|
|
|
@ -51,10 +51,10 @@ import net.minecraftforge.client.model.generators.ModelFile;
|
||||||
public class BuilderTransformers {
|
public class BuilderTransformers {
|
||||||
|
|
||||||
public static <B extends EncasedShaftBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> encasedShaft(String casing,
|
public static <B extends EncasedShaftBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> encasedShaft(String casing,
|
||||||
CTSpriteShiftEntry casingShift) {
|
Supplier<CTSpriteShiftEntry> casingShift) {
|
||||||
return builder -> encasedBase(builder, () -> AllBlocks.SHAFT.get())
|
return builder -> encasedBase(builder, () -> AllBlocks.SHAFT.get())
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(casingShift)))
|
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(casingShift.get())))
|
||||||
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, casingShift,
|
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, casingShift.get(),
|
||||||
(s, f) -> f.getAxis() != s.getValue(EncasedShaftBlock.AXIS))))
|
(s, f) -> f.getAxis() != s.getValue(EncasedShaftBlock.AXIS))))
|
||||||
.blockstate((c, p) -> axisBlock(c, p, blockState -> p.models()
|
.blockstate((c, p) -> axisBlock(c, p, blockState -> p.models()
|
||||||
.getExistingFile(p.modLoc("block/encased_shaft/block_" + casing)), true))
|
.getExistingFile(p.modLoc("block/encased_shaft/block_" + casing)), true))
|
||||||
|
@ -64,24 +64,24 @@ public class BuilderTransformers {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <B extends EncasedCogwheelBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> encasedCogwheel(
|
public static <B extends EncasedCogwheelBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> encasedCogwheel(
|
||||||
String casing, CTSpriteShiftEntry casingShift) {
|
String casing, Supplier<CTSpriteShiftEntry> casingShift) {
|
||||||
return b -> encasedCogwheelBase(b, casing, casingShift, () -> AllBlocks.COGWHEEL.get(), false);
|
return b -> encasedCogwheelBase(b, casing, casingShift, () -> AllBlocks.COGWHEEL.get(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <B extends EncasedCogwheelBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> encasedLargeCogwheel(
|
public static <B extends EncasedCogwheelBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> encasedLargeCogwheel(
|
||||||
String casing, CTSpriteShiftEntry casingShift) {
|
String casing, Supplier<CTSpriteShiftEntry> casingShift) {
|
||||||
return b -> encasedCogwheelBase(b, casing, casingShift, () -> AllBlocks.LARGE_COGWHEEL.get(), true)
|
return b -> encasedCogwheelBase(b, casing, casingShift, () -> AllBlocks.LARGE_COGWHEEL.get(), true)
|
||||||
.onRegister(CreateRegistrate.connectedTextures(new EncasedCogCTBehaviour(casingShift)));
|
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCogCTBehaviour(casingShift.get())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <B extends EncasedCogwheelBlock, P> BlockBuilder<B, P> encasedCogwheelBase(BlockBuilder<B, P> b,
|
private static <B extends EncasedCogwheelBlock, P> BlockBuilder<B, P> encasedCogwheelBase(BlockBuilder<B, P> b,
|
||||||
String casing, CTSpriteShiftEntry casingShift, Supplier<ItemLike> drop, boolean large) {
|
String casing, Supplier<CTSpriteShiftEntry> casingShift, Supplier<ItemLike> drop, boolean large) {
|
||||||
String encasedSuffix = "_encased_cogwheel_side" + (large ? "_connected" : "");
|
String encasedSuffix = "_encased_cogwheel_side" + (large ? "_connected" : "");
|
||||||
String blockFolder = large ? "encased_large_cogwheel" : "encased_cogwheel";
|
String blockFolder = large ? "encased_large_cogwheel" : "encased_cogwheel";
|
||||||
String wood = casing.equals("brass") ? "dark_oak" : "spruce";
|
String wood = casing.equals("brass") ? "dark_oak" : "spruce";
|
||||||
return encasedBase(b, drop)
|
return encasedBase(b, drop)
|
||||||
.addLayer(() -> RenderType::cutoutMipped)
|
.addLayer(() -> RenderType::cutoutMipped)
|
||||||
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, casingShift,
|
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, casingShift.get(),
|
||||||
(s, f) -> f.getAxis() == s.getValue(EncasedCogwheelBlock.AXIS)
|
(s, f) -> f.getAxis() == s.getValue(EncasedCogwheelBlock.AXIS)
|
||||||
&& !s.getValue(f.getAxisDirection() == AxisDirection.POSITIVE ? EncasedCogwheelBlock.TOP_SHAFT
|
&& !s.getValue(f.getAxisDirection() == AxisDirection.POSITIVE ? EncasedCogwheelBlock.TOP_SHAFT
|
||||||
: EncasedCogwheelBlock.BOTTOM_SHAFT))))
|
: EncasedCogwheelBlock.BOTTOM_SHAFT))))
|
||||||
|
@ -138,12 +138,12 @@ public class BuilderTransformers {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <B extends CasingBlock> NonNullUnaryOperator<BlockBuilder<B, CreateRegistrate>> casing(
|
public static <B extends CasingBlock> NonNullUnaryOperator<BlockBuilder<B, CreateRegistrate>> casing(
|
||||||
CTSpriteShiftEntry ct) {
|
Supplier<CTSpriteShiftEntry> ct) {
|
||||||
return b -> b.initialProperties(SharedProperties::stone)
|
return b -> b.initialProperties(SharedProperties::stone)
|
||||||
.transform(axeOrPickaxe())
|
.transform(axeOrPickaxe())
|
||||||
.blockstate((c, p) -> p.simpleBlock(c.get()))
|
.blockstate((c, p) -> p.simpleBlock(c.get()))
|
||||||
.onRegister(connectedTextures(new EncasedCTBehaviour(ct)))
|
.onRegister(connectedTextures(() -> new EncasedCTBehaviour(ct.get())))
|
||||||
.onRegister(casingConnectivity((block, cc) -> cc.makeCasing(block, ct)))
|
.onRegister(casingConnectivity((block, cc) -> cc.makeCasing(block, ct.get())))
|
||||||
.simpleItem();
|
.simpleItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
||||||
|
|
||||||
/* Util */
|
/* Util */
|
||||||
|
|
||||||
public static <T extends Block> NonNullConsumer<? super T> connectedTextures(ConnectedTextureBehaviour behavior) {
|
public static <T extends Block> NonNullConsumer<? super T> connectedTextures(Supplier<ConnectedTextureBehaviour> behavior) {
|
||||||
return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior));
|
return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,8 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private static void registerCTBehviour(Block entry, ConnectedTextureBehaviour behavior) {
|
private static void registerCTBehviour(Block entry, Supplier<ConnectedTextureBehaviour> behaviorSupplier) {
|
||||||
|
ConnectedTextureBehaviour behavior = behaviorSupplier.get();
|
||||||
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
|
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
|
||||||
.register(entry.delegate, model -> new CTModel(model, behavior));
|
.register(entry.delegate, model -> new CTModel(model, behavior));
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class WindowGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockEntry<WindowBlock> customWindowBlock(String name, Supplier<? extends ItemLike> ingredient,
|
public static BlockEntry<WindowBlock> customWindowBlock(String name, Supplier<? extends ItemLike> ingredient,
|
||||||
CTSpriteShiftEntry ct, Supplier<Supplier<RenderType>> renderType) {
|
Supplier<CTSpriteShiftEntry> ct, Supplier<Supplier<RenderType>> renderType) {
|
||||||
NonNullFunction<String, ResourceLocation> end_texture = n -> Create.asResource(palettesDir() + name + "_end");
|
NonNullFunction<String, ResourceLocation> end_texture = n -> Create.asResource(palettesDir() + name + "_end");
|
||||||
NonNullFunction<String, ResourceLocation> side_texture = n -> Create.asResource(palettesDir() + n);
|
NonNullFunction<String, ResourceLocation> side_texture = n -> Create.asResource(palettesDir() + n);
|
||||||
return windowBlock(name, ingredient, ct, renderType, end_texture, side_texture);
|
return windowBlock(name, ingredient, ct, renderType, end_texture, side_texture);
|
||||||
|
@ -78,15 +78,15 @@ public class WindowGen {
|
||||||
NonNullFunction<String, ResourceLocation> end_texture =
|
NonNullFunction<String, ResourceLocation> end_texture =
|
||||||
$ -> new ResourceLocation("block/" + woodName + "_planks");
|
$ -> new ResourceLocation("block/" + woodName + "_planks");
|
||||||
NonNullFunction<String, ResourceLocation> side_texture = n -> Create.asResource(palettesDir() + n);
|
NonNullFunction<String, ResourceLocation> side_texture = n -> Create.asResource(palettesDir() + n);
|
||||||
return windowBlock(name, () -> planksBlock, AllSpriteShifts.getWoodenWindow(woodType), renderType, end_texture,
|
return windowBlock(name, () -> planksBlock, () -> AllSpriteShifts.getWoodenWindow(woodType), renderType, end_texture,
|
||||||
side_texture);
|
side_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockEntry<WindowBlock> windowBlock(String name, Supplier<? extends ItemLike> ingredient,
|
public static BlockEntry<WindowBlock> windowBlock(String name, Supplier<? extends ItemLike> ingredient,
|
||||||
CTSpriteShiftEntry ct, Supplier<Supplier<RenderType>> renderType,
|
Supplier<CTSpriteShiftEntry> ct, Supplier<Supplier<RenderType>> renderType,
|
||||||
NonNullFunction<String, ResourceLocation> endTexture, NonNullFunction<String, ResourceLocation> sideTexture) {
|
NonNullFunction<String, ResourceLocation> endTexture, NonNullFunction<String, ResourceLocation> sideTexture) {
|
||||||
return REGISTRATE.block(name, WindowBlock::new)
|
return REGISTRATE.block(name, WindowBlock::new)
|
||||||
.onRegister(connectedTextures(new HorizontalCTBehaviour(ct)))
|
.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(ct.get())))
|
||||||
.addLayer(renderType)
|
.addLayer(renderType)
|
||||||
.recipe((c, p) -> ShapedRecipeBuilder.shaped(c.get(), 2)
|
.recipe((c, p) -> ShapedRecipeBuilder.shaped(c.get(), 2)
|
||||||
.pattern(" # ")
|
.pattern(" # ")
|
||||||
|
@ -105,7 +105,7 @@ public class WindowGen {
|
||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockEntry<ConnectedGlassBlock> framedGlass(String name, ConnectedTextureBehaviour behaviour) {
|
public static BlockEntry<ConnectedGlassBlock> framedGlass(String name, Supplier<ConnectedTextureBehaviour> behaviour) {
|
||||||
return REGISTRATE.block(name, ConnectedGlassBlock::new)
|
return REGISTRATE.block(name, ConnectedGlassBlock::new)
|
||||||
.onRegister(connectedTextures(behaviour))
|
.onRegister(connectedTextures(behaviour))
|
||||||
.addLayer(() -> RenderType::translucent)
|
.addLayer(() -> RenderType::translucent)
|
||||||
|
@ -124,7 +124,7 @@ public class WindowGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockEntry<ConnectedGlassPaneBlock> framedGlassPane(String name, Supplier<? extends Block> parent,
|
public static BlockEntry<ConnectedGlassPaneBlock> framedGlassPane(String name, Supplier<? extends Block> parent,
|
||||||
CTSpriteShiftEntry ctshift) {
|
Supplier<CTSpriteShiftEntry> ctshift) {
|
||||||
ResourceLocation sideTexture = Create.asResource(palettesDir() + "framed_glass");
|
ResourceLocation sideTexture = Create.asResource(palettesDir() + "framed_glass");
|
||||||
ResourceLocation itemSideTexture = Create.asResource(palettesDir() + name);
|
ResourceLocation itemSideTexture = Create.asResource(palettesDir() + name);
|
||||||
ResourceLocation topTexture = Create.asResource(palettesDir() + "framed_glass_pane_top");
|
ResourceLocation topTexture = Create.asResource(palettesDir() + "framed_glass_pane_top");
|
||||||
|
@ -133,7 +133,7 @@ public class WindowGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockEntry<ConnectedGlassPaneBlock> customWindowPane(String name, Supplier<? extends Block> parent,
|
public static BlockEntry<ConnectedGlassPaneBlock> customWindowPane(String name, Supplier<? extends Block> parent,
|
||||||
CTSpriteShiftEntry ctshift, Supplier<Supplier<RenderType>> renderType) {
|
Supplier<CTSpriteShiftEntry> ctshift, Supplier<Supplier<RenderType>> renderType) {
|
||||||
ResourceLocation topTexture = Create.asResource(palettesDir() + name + "_pane_top");
|
ResourceLocation topTexture = Create.asResource(palettesDir() + name + "_pane_top");
|
||||||
ResourceLocation sideTexture = Create.asResource(palettesDir() + name);
|
ResourceLocation sideTexture = Create.asResource(palettesDir() + name);
|
||||||
return connectedGlassPane(name, parent, ctshift, sideTexture, sideTexture, topTexture, renderType);
|
return connectedGlassPane(name, parent, ctshift, sideTexture, sideTexture, topTexture, renderType);
|
||||||
|
@ -150,7 +150,7 @@ public class WindowGen {
|
||||||
String name = woodName + "_window";
|
String name = woodName + "_window";
|
||||||
ResourceLocation topTexture = new ResourceLocation("block/" + woodName + "_planks");
|
ResourceLocation topTexture = new ResourceLocation("block/" + woodName + "_planks");
|
||||||
ResourceLocation sideTexture = Create.asResource(palettesDir() + name);
|
ResourceLocation sideTexture = Create.asResource(palettesDir() + name);
|
||||||
return connectedGlassPane(name, parent, AllSpriteShifts.getWoodenWindow(woodType), sideTexture, sideTexture,
|
return connectedGlassPane(name, parent, () -> AllSpriteShifts.getWoodenWindow(woodType), sideTexture, sideTexture,
|
||||||
topTexture, renderType);
|
topTexture, renderType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,10 +163,10 @@ public class WindowGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BlockEntry<ConnectedGlassPaneBlock> connectedGlassPane(String name, Supplier<? extends Block> parent,
|
private static BlockEntry<ConnectedGlassPaneBlock> connectedGlassPane(String name, Supplier<? extends Block> parent,
|
||||||
CTSpriteShiftEntry ctshift, ResourceLocation sideTexture, ResourceLocation itemSideTexture,
|
Supplier<CTSpriteShiftEntry> ctshift, ResourceLocation sideTexture, ResourceLocation itemSideTexture,
|
||||||
ResourceLocation topTexture, Supplier<Supplier<RenderType>> renderType) {
|
ResourceLocation topTexture, Supplier<Supplier<RenderType>> renderType) {
|
||||||
NonNullConsumer<? super ConnectedGlassPaneBlock> connectedTextures =
|
NonNullConsumer<? super ConnectedGlassPaneBlock> connectedTextures =
|
||||||
connectedTextures(new GlassPaneCTBehaviour(ctshift));
|
connectedTextures(() -> new GlassPaneCTBehaviour(ctshift.get()));
|
||||||
String CGPparents = "block/connected_glass_pane/";
|
String CGPparents = "block/connected_glass_pane/";
|
||||||
String prefix = name + "_pane_";
|
String prefix = name + "_pane_";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.simibubi.create.foundation.render;
|
package com.simibubi.create.foundation.render;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.core.layout.CommonItems;
|
|
||||||
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
import com.jozufozu.flywheel.core.layout.BufferLayout;
|
||||||
|
import com.jozufozu.flywheel.core.layout.CommonItems;
|
||||||
|
|
||||||
public class AllInstanceFormats {
|
public class AllInstanceFormats {
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
// Vertex Coloring
|
// Vertex Coloring
|
||||||
private boolean shouldColor;
|
private boolean shouldColor;
|
||||||
private int r, g, b, a;
|
private int r, g, b, a;
|
||||||
private boolean disableDiffuseDiv;
|
|
||||||
private boolean disableDiffuseMult;
|
private boolean disableDiffuseMult;
|
||||||
|
|
||||||
// Vertex Texture Coords
|
// Vertex Texture Coords
|
||||||
|
@ -69,16 +68,6 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
transforms.pushPose();
|
transforms.pushPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getUnInterpolatedU(TextureAtlasSprite sprite, float u) {
|
|
||||||
float f = sprite.getU1() - sprite.getU0();
|
|
||||||
return (u - sprite.getU0()) / f * 16.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getUnInterpolatedV(TextureAtlasSprite sprite, float v) {
|
|
||||||
float f = sprite.getV1() - sprite.getV0();
|
|
||||||
return (v - sprite.getV0()) / f * 16.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderInto(PoseStack input, VertexConsumer builder) {
|
public void renderInto(PoseStack input, VertexConsumer builder) {
|
||||||
if (isEmpty())
|
if (isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -113,10 +102,11 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
float x = template.getX(i);
|
float x = template.getX(i);
|
||||||
float y = template.getY(i);
|
float y = template.getY(i);
|
||||||
float z = template.getZ(i);
|
float z = template.getZ(i);
|
||||||
byte r = template.getR(i);
|
|
||||||
byte g = template.getG(i);
|
pos.set(x, y, z, 1F);
|
||||||
byte b = template.getB(i);
|
pos.transform(modelMat);
|
||||||
byte a = template.getA(i);
|
builder.vertex(pos.x(), pos.y(), pos.z());
|
||||||
|
|
||||||
float normalX = template.getNX(i);
|
float normalX = template.getNX(i);
|
||||||
float normalY = template.getNY(i);
|
float normalY = template.getNY(i);
|
||||||
float normalZ = template.getNZ(i);
|
float normalZ = template.getNZ(i);
|
||||||
|
@ -127,39 +117,26 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
float ny = normal.y();
|
float ny = normal.y();
|
||||||
float nz = normal.z();
|
float nz = normal.z();
|
||||||
|
|
||||||
float instanceDiffuse = LightUtil.diffuseLight(nx, ny, nz);
|
byte r, g, b, a;
|
||||||
|
|
||||||
pos.set(x, y, z, 1F);
|
|
||||||
pos.transform(modelMat);
|
|
||||||
builder.vertex(pos.x(), pos.y(), pos.z());
|
|
||||||
|
|
||||||
//builder.color(nx, ny, nz, 1f);
|
|
||||||
if (shouldColor) {
|
if (shouldColor) {
|
||||||
if (disableDiffuseMult) {
|
r = (byte) this.r;
|
||||||
builder.color(this.r, this.g, this.b, this.a);
|
g = (byte) this.g;
|
||||||
} else {
|
b = (byte) this.b;
|
||||||
int colorR = transformColor(this.r, instanceDiffuse);
|
a = (byte) this.a;
|
||||||
int colorG = transformColor(this.g, instanceDiffuse);
|
|
||||||
int colorB = transformColor(this.b, instanceDiffuse);
|
|
||||||
builder.color(colorR, colorG, colorB, this.a);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (disableDiffuseDiv && disableDiffuseMult) {
|
r = template.getR(i);
|
||||||
builder.color(r, g, b, a);
|
g = template.getG(i);
|
||||||
} else {
|
b = template.getB(i);
|
||||||
float diffuseMult;
|
a = template.getA(i);
|
||||||
if (disableDiffuseDiv) {
|
}
|
||||||
diffuseMult = instanceDiffuse;
|
if (disableDiffuseMult) {
|
||||||
} else if (disableDiffuseMult) {
|
builder.color(r, g, b, a);
|
||||||
diffuseMult = 1;
|
} else {
|
||||||
} else {
|
float instanceDiffuse = LightUtil.diffuseLight(nx, ny, nz);
|
||||||
diffuseMult = instanceDiffuse;
|
int colorR = transformColor(r, instanceDiffuse);
|
||||||
}
|
int colorG = transformColor(g, instanceDiffuse);
|
||||||
int colorR = transformColor(r, diffuseMult);
|
int colorB = transformColor(b, instanceDiffuse);
|
||||||
int colorG = transformColor(g, diffuseMult);
|
builder.color(colorR, colorG, colorB, a);
|
||||||
int colorB = transformColor(b, diffuseMult);
|
|
||||||
builder.color(colorR, colorG, colorB, a);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float u = template.getU(i);
|
float u = template.getU(i);
|
||||||
|
@ -216,7 +193,6 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
g = 0;
|
g = 0;
|
||||||
b = 0;
|
b = 0;
|
||||||
a = 0;
|
a = 0;
|
||||||
disableDiffuseDiv = false;
|
|
||||||
disableDiffuseMult = false;
|
disableDiffuseMult = false;
|
||||||
spriteShiftFunc = null;
|
spriteShiftFunc = null;
|
||||||
hasOverlay = false;
|
hasOverlay = false;
|
||||||
|
@ -230,6 +206,10 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return template.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuperByteBuffer translate(double x, double y, double z) {
|
public SuperByteBuffer translate(double x, double y, double z) {
|
||||||
transforms.translate(x, y, z);
|
transforms.translate(x, y, z);
|
||||||
|
@ -242,6 +222,24 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuperByteBuffer scale(float factorX, float factorY, float factorZ) {
|
||||||
|
transforms.scale(factorX, factorY, factorZ);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuperByteBuffer pushPose() {
|
||||||
|
transforms.pushPose();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuperByteBuffer popPose() {
|
||||||
|
transforms.popPose();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public SuperByteBuffer transform(PoseStack stack) {
|
public SuperByteBuffer transform(PoseStack stack) {
|
||||||
transforms.last()
|
transforms.last()
|
||||||
.pose()
|
.pose()
|
||||||
|
@ -288,16 +286,6 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
return color(c.getRGB());
|
return color(c.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents vertex colors from being divided by the diffuse value calculated from the raw untransformed normal vector.
|
|
||||||
* Useful when passed vertex colors do not have diffuse baked in.
|
|
||||||
* Disabled when custom color is used.
|
|
||||||
*/
|
|
||||||
public SuperByteBuffer disableDiffuseDiv() {
|
|
||||||
disableDiffuseDiv = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevents vertex colors from being multiplied by the diffuse value calculated from the final transformed normal vector.
|
* Prevents vertex colors from being multiplied by the diffuse value calculated from the final transformed normal vector.
|
||||||
* Useful for entity rendering, when diffuse is applied automatically later.
|
* Useful for entity rendering, when diffuse is applied automatically later.
|
||||||
|
@ -401,10 +389,6 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return template.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int transformColor(byte component, float scale) {
|
public static int transformColor(byte component, float scale) {
|
||||||
return Mth.clamp((int) (Byte.toUnsignedInt(component) * scale), 0, 255);
|
return Mth.clamp((int) (Byte.toUnsignedInt(component) * scale), 0, 255);
|
||||||
}
|
}
|
||||||
|
@ -413,6 +397,16 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
return Mth.clamp((int) (component * scale), 0, 255);
|
return Mth.clamp((int) (component * scale), 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getUnInterpolatedU(TextureAtlasSprite sprite, float u) {
|
||||||
|
float f = sprite.getU1() - sprite.getU0();
|
||||||
|
return (u - sprite.getU0()) / f * 16.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getUnInterpolatedV(TextureAtlasSprite sprite, float v) {
|
||||||
|
float f = sprite.getV1() - sprite.getV0();
|
||||||
|
return (v - sprite.getV0()) / f * 16.0F;
|
||||||
|
}
|
||||||
|
|
||||||
public static int maxLight(int packedLight1, int packedLight2) {
|
public static int maxLight(int packedLight1, int packedLight2) {
|
||||||
int blockLight1 = LightTexture.block(packedLight1);
|
int blockLight1 = LightTexture.block(packedLight1);
|
||||||
int skyLight1 = LightTexture.sky(packedLight1);
|
int skyLight1 = LightTexture.sky(packedLight1);
|
||||||
|
@ -426,24 +420,6 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
return WORLD_LIGHT_CACHE.computeIfAbsent(pos.asLong(), $ -> LevelRenderer.getLightColor(world, pos));
|
return WORLD_LIGHT_CACHE.computeIfAbsent(pos.asLong(), $ -> LevelRenderer.getLightColor(world, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SuperByteBuffer scale(float factorX, float factorY, float factorZ) {
|
|
||||||
transforms.scale(factorX, factorY, factorZ);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SuperByteBuffer pushPose() {
|
|
||||||
transforms.pushPose();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SuperByteBuffer popPose() {
|
|
||||||
transforms.popPose();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface SpriteShiftFunc {
|
public interface SpriteShiftFunc {
|
||||||
void shift(VertexConsumer builder, float u, float v);
|
void shift(VertexConsumer builder, float u, float v);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.repack.joml.Vector3i;
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.Pair;
|
import com.simibubi.create.foundation.utility.Pair;
|
||||||
|
|
Loading…
Reference in a new issue