Bulk remap, compiles

This commit is contained in:
grimmauld 2021-07-15 11:32:03 +02:00
parent a8bdf710fa
commit a048285699
1007 changed files with 13314 additions and 12817 deletions

View file

@ -32,7 +32,7 @@ archivesBaseName = 'create'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
mappings channel: 'snapshot', version: '20200920-mixed-1.16.3'
mappings channel: 'official', version: "${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {

View file

@ -127,14 +127,14 @@ public class AllBlockPartials {
Map<Direction, PartialModel> map = new HashMap<>();
for (Direction d : Iterate.directions) {
String asId = Lang.asId(type.name());
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getString())));
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getSerializedName())));
}
PIPE_ATTACHMENTS.put(type, map);
}
for (BlazeBurnerBlock.HeatLevel heat : BlazeBurnerBlock.HeatLevel.values()) {
if (heat == BlazeBurnerBlock.HeatLevel.NONE)
continue;
BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getString()));
BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getSerializedName()));
}
}

View file

@ -221,14 +221,14 @@ public class AllBlocks {
.initialProperties(() -> Blocks.DISPENSER)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.loot((lt, block) -> {
Builder builder = LootTable.builder();
IBuilder survivesExplosion = SurvivesExplosion.builder();
lt.registerLootTable(block, builder.addLootPool(LootPool.builder()
.acceptCondition(survivesExplosion)
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(AllBlocks.SCHEMATICANNON.get().asItem())
.acceptFunction(CopyNbt.func_215881_a(CopyNbt.Source.BLOCK_ENTITY)
.func_216056_a("Options", "BlockEntityTag.Options")))));
Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion();
lt.add(block, builder.withPool(LootPool.lootPool()
.when(survivesExplosion)
.setRolls(ConstantRange.exactly(1))
.add(ItemLootEntry.lootTableItem(AllBlocks.SCHEMATICANNON.get().asItem())
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY)
.copy("Options", "BlockEntityTag.Options")))));
})
.item()
.transform(customItemModel())
@ -289,11 +289,11 @@ public class AllBlocks {
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING)))
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING,
(s, f) -> f.getAxis() == s.get(GearboxBlock.AXIS))))
(s, f) -> f.getAxis() == s.getValue(GearboxBlock.AXIS))))
.blockstate((c, p) -> axisBlock(c, p, $ -> AssetLookup.partialBaseModel(c, p), true))
.item()
.transform(customItemModel())
@ -301,7 +301,7 @@ public class AllBlocks {
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item()
@ -310,7 +310,7 @@ public class AllBlocks {
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item()
@ -320,7 +320,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedBeltBlock> ENCASED_CHAIN_DRIVE =
REGISTRATE.block("encased_chain_drive", EncasedBeltBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
@ -331,10 +331,10 @@ public class AllBlocks {
public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_CHAIN_GEARSHIFT =
REGISTRATE.block("adjustable_chain_gearshift", AdjustablePulleyBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> {
String powered = state.get(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
String powered = state.getValue(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
return p.models()
.withExistingParent(c.getName() + "_" + suffix + powered,
p.modLoc("block/encased_chain_drive/" + suffix))
@ -347,9 +347,9 @@ public class AllBlocks {
.register();
public static final BlockEntry<BeltBlock> BELT = REGISTRATE.block("belt", BeltBlock::new)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.GRAY)
.properties(p -> p.sound(SoundType.CLOTH))
.properties(p -> p.hardnessAndResistance(0.8F))
.initialProperties(SharedProperties.beltMaterial, MaterialColor.COLOR_GRAY)
.properties(p -> p.sound(SoundType.WOOL))
.properties(p -> p.strength(0.8F))
.blockstate(new BeltGenerator()::generate)
.transform(StressConfigDefaults.setImpact(1.0))
.onRegister(CreateRegistrate.blockModel(() -> BeltModel::new))
@ -368,9 +368,9 @@ public class AllBlocks {
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
.initialProperties(SharedProperties::wooden)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setCapacity(16.0))
.simpleItem()
.register();
@ -378,7 +378,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedFanBlock> ENCASED_FAN = REGISTRATE.block("encased_fan", EncasedFanBlock::new)
.initialProperties(SharedProperties::stone)
.blockstate(BlockStateGen.directionalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setCapacity(16.0))
.transform(StressConfigDefaults.setImpact(2.0))
.item()
@ -389,7 +389,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.BRITTLE.tag)
.blockstate(BlockStateGen.directionalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel())
.register();
@ -434,9 +434,9 @@ public class AllBlocks {
public static final BlockEntry<CrushingWheelBlock> CRUSHING_WHEEL =
REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.axisBlockProvider(false))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setImpact(8.0))
.simpleItem()
.register();
@ -454,7 +454,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS =
REGISTRATE.block("mechanical_press", MechanicalPressBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(StressConfigDefaults.setImpact(8.0))
.item(AssemblyOperatorBlockItem::new)
@ -464,9 +464,9 @@ public class AllBlocks {
public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER =
REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setImpact(4.0))
.item(AssemblyOperatorBlockItem::new)
.transform(customItemModel())
@ -474,7 +474,7 @@ public class AllBlocks {
public static final BlockEntry<BasinBlock> BASIN = REGISTRATE.block("basin", BasinBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.sound(SoundType.NETHERITE))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.blockstate(new BasinGenerator()::generate)
.onRegister(addMovementBehaviour(new BasinMovementBehaviour()))
.item()
@ -484,10 +484,10 @@ public class AllBlocks {
public static final BlockEntry<BlazeBurnerBlock> BLAZE_BURNER =
REGISTRATE.block("blaze_burner", BlazeBurnerBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance($ -> 12))
.addLayer(() -> RenderType::getCutoutMipped)
.properties(p -> p.lightLevel($ -> 12))
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.FAN_HEATERS.tag)
.loot((lt, block) -> lt.registerLootTable(block, BlazeBurnerBlock.buildLootTable()))
.loot((lt, block) -> lt.add(block, BlazeBurnerBlock.buildLootTable()))
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.item(BlazeBurnerBlockItem::withBlaze)
.model(AssetLookup.<BlazeBurnerBlockItem>customBlockItemModel("blaze_burner", "block_with_blaze"))
@ -497,14 +497,14 @@ public class AllBlocks {
public static final BlockEntry<LitBlazeBurnerBlock> LIT_BLAZE_BURNER =
REGISTRATE.block("lit_blaze_burner", LitBlazeBurnerBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance(LitBlazeBurnerBlock::getLight))
.addLayer(() -> RenderType::getCutoutMipped)
.properties(p -> p.lightLevel(LitBlazeBurnerBlock::getLight))
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.FAN_HEATERS.tag)
.loot((lt, block) -> lt.registerDropping(block, AllItems.EMPTY_BLAZE_BURNER.get()))
.loot((lt, block) -> lt.dropOther(block, AllItems.EMPTY_BLAZE_BURNER.get()))
.blockstate((c, p) -> p.getVariantBuilder(c.get()).forAllStates(state ->
ConfiguredModel.builder()
.modelFile(p.models().getExistingFile(p.modLoc(
"block/blaze_burner/" + (state.get(LitBlazeBurnerBlock.FLAME_TYPE) == LitBlazeBurnerBlock.FlameType.SOUL ? "block_with_soul_fire" : "block_with_fire")
"block/blaze_burner/" + (state.getValue(LitBlazeBurnerBlock.FLAME_TYPE) == LitBlazeBurnerBlock.FlameType.SOUL ? "block_with_soul_fire" : "block_with_fire")
)))
.build()))
.register();
@ -519,7 +519,7 @@ public class AllBlocks {
public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR =
REGISTRATE.block("weighted_ejector", EjectorBlock::new)
.initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180))
.transform(StressConfigDefaults.setImpact(2.0))
.item(EjectorItem::new)
@ -528,8 +528,8 @@ public class AllBlocks {
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE))
.addLayer(() -> RenderType::getCutoutMipped)
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.addLayer(() -> RenderType::cutoutMipped)
.blockstate(new ChuteGenerator()::generate)
.item(ChuteItem::new)
.transform(customItemModel("_", "block"))
@ -537,7 +537,7 @@ public class AllBlocks {
public static final BlockEntry<SmartChuteBlock> SMART_CHUTE = REGISTRATE.block("smart_chute", SmartChuteBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p)))
.item()
.transform(customItemModel("_", "block"))
@ -584,23 +584,23 @@ public class AllBlocks {
public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE =
REGISTRATE.block("encased_fluid_pipe", EncasedPipeBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.encasedPipe())
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING,
(s, f) -> !s.get(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f)))))
(s, f) -> !s.getValue(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f)))))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.loot((p, b) -> p.registerDropping(b, FLUID_PIPE.get()))
.loot((p, b) -> p.dropOther(b, FLUID_PIPE.get()))
.register();
public static final BlockEntry<GlassFluidPipeBlock> GLASS_FLUID_PIPE =
REGISTRATE.block("glass_fluid_pipe", GlassFluidPipeBlock::new)
.initialProperties(SharedProperties::softMetal)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, s -> p.models()
.getExistingFile(p.modLoc("block/fluid_pipe/window" + (s.get(GlassFluidPipeBlock.ALT) ? "_alt" : "")))))
.getExistingFile(p.modLoc("block/fluid_pipe/window" + (s.getValue(GlassFluidPipeBlock.ALT) ? "_alt" : "")))))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.loot((p, b) -> p.registerDropping(b, FLUID_PIPE.get()))
.loot((p, b) -> p.dropOther(b, FLUID_PIPE.get()))
.register();
public static final BlockEntry<PumpBlock> MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new)
@ -625,7 +625,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::softMetal)
.blockstate((c, p) -> BlockStateGen.directionalAxisBlock(c, p,
(state, vertical) -> AssetLookup.partialBaseModel(c, p, vertical ? "vertical" : "horizontal",
state.get(FluidValveBlock.ENABLED) ? "open" : "closed")))
state.getValue(FluidValveBlock.ENABLED) ? "open" : "closed")))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.item()
.transform(customItemModel())
@ -637,25 +637,25 @@ public class AllBlocks {
.register();
public static final DyedBlockList<ValveHandleBlock> DYED_VALVE_HANDLES = new DyedBlockList<>(colour -> {
String colourName = colour.getString();
String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_valve_handle", ValveHandleBlock::dyed)
.transform(BuilderTransformers.valveHandle(colour))
.recipe((c, p) -> ShapedRecipeBuilder.shapedRecipe(c.get())
.patternLine("#")
.patternLine("-")
.key('#', DyeHelper.getTagOfDye(colour))
.key('-', AllItemTags.VALVE_HANDLES.tag)
.addCriterion("has_valve", RegistrateRecipeProvider.hasItem(AllItemTags.VALVE_HANDLES.tag))
.build(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_valve_handle")))
.recipe((c, p) -> ShapedRecipeBuilder.shaped(c.get())
.pattern("#")
.pattern("-")
.define('#', DyeHelper.getTagOfDye(colour))
.define('-', AllItemTags.VALVE_HANDLES.tag)
.unlockedBy("has_valve", RegistrateRecipeProvider.hasItem(AllItemTags.VALVE_HANDLES.tag))
.save(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_valve_handle")))
.register();
});
public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular)
.initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(new FluidTankGenerator()::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item(FluidTankItem::new)
.model(AssetLookup.<FluidTankItem>customBlockItemModel("_", "block_single_window"))
.build()
@ -665,10 +665,10 @@ public class AllBlocks {
REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative)
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(new FluidTankGenerator("creative_")::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::creative))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item(FluidTankItem::new)
.properties(p -> p.rarity(Rarity.EPIC))
.model((c, p) -> p.withExistingParent(c.getName(), p.modLoc("block/fluid_tank/block_single_window"))
@ -688,7 +688,7 @@ public class AllBlocks {
public static final BlockEntry<ItemDrainBlock> ITEM_DRAIN = REGISTRATE.block("item_drain", ItemDrainBlock::new)
.initialProperties(SharedProperties::softMetal)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.standardModel(c, p)))
.simpleItem()
.register();
@ -696,7 +696,7 @@ public class AllBlocks {
public static final BlockEntry<SpoutBlock> SPOUT = REGISTRATE.block("spout", SpoutBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item(AssemblyOperatorBlockItem::new)
.transform(customItemModel())
.register();
@ -734,16 +734,16 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPistonHeadBlock> MECHANICAL_PISTON_HEAD =
REGISTRATE.block("mechanical_piston_head", MechanicalPistonHeadBlock::new)
.initialProperties(() -> Blocks.PISTON_HEAD)
.loot((p, b) -> p.registerDropping(b, PISTON_EXTENSION_POLE.get()))
.loot((p, b) -> p.dropOther(b, PISTON_EXTENSION_POLE.get()))
.blockstate((c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, state -> p.models()
.getExistingFile(p.modLoc("block/mechanical_piston/" + state.get(MechanicalPistonHeadBlock.TYPE)
.getString() + "/head"))))
.getExistingFile(p.modLoc("block/mechanical_piston/" + state.getValue(MechanicalPistonHeadBlock.TYPE)
.getSerializedName() + "/head"))))
.register();
public static final BlockEntry<GantryCarriageBlock> GANTRY_CARRIAGE =
REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new)
.initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalAxisBlockProvider())
.item()
.transform(customItemModel())
@ -753,11 +753,11 @@ public class AllBlocks {
REGISTRATE.block("gantry_shaft", GantryShaftBlock::new)
.initialProperties(SharedProperties::stone)
.blockstate((c, p) -> p.directionalBlock(c.get(), s -> {
boolean isPowered = s.get(GantryShaftBlock.POWERED);
boolean isFlipped = s.get(GantryShaftBlock.FACING)
boolean isPowered = s.getValue(GantryShaftBlock.POWERED);
boolean isFlipped = s.getValue(GantryShaftBlock.FACING)
.getAxisDirection() == AxisDirection.NEGATIVE;
String partName = s.get(GantryShaftBlock.PART)
.getString();
String partName = s.getValue(GantryShaftBlock.PART)
.getSerializedName();
String flipped = isFlipped ? "_flipped" : "";
String powered = isPowered ? "_powered" : "";
ModelFile existing = AssetLookup.partialBaseModel(c, p, partName);
@ -804,9 +804,9 @@ public class AllBlocks {
.register();
public static final BlockEntry<PulleyBlock.RopeBlock> ROPE = REGISTRATE.block("rope", PulleyBlock.RopeBlock::new)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.BROWN)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.COLOR_BROWN)
.tag(AllBlockTags.BRITTLE.tag)
.properties(p -> p.sound(SoundType.CLOTH))
.properties(p -> p.sound(SoundType.WOOL))
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models()
.getExistingFile(p.modLoc("block/rope_pulley/" + c.getName()))))
.register();
@ -822,9 +822,9 @@ public class AllBlocks {
public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER =
REGISTRATE.block("cart_assembler", CartAssemblerBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.cartAssembler())
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.tag(BlockTags.RAILS, AllBlockTags.SAFE_NBT.tag)
.item(CartAssemblerBlockItem::new)
.transform(customItemModel())
@ -833,9 +833,9 @@ public class AllBlocks {
public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL =
REGISTRATE.block("reinforced_rail", ReinforcedRailBlock::new)
.initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.reinforcedRail())
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.tag(BlockTags.RAILS)
.item()
.model((c, p) -> p.blockItem(() -> c.getEntry()
@ -847,7 +847,7 @@ public class AllBlocks {
REGISTRATE.block("controller_rail", ControllerRailBlock::new)
.initialProperties(() -> Blocks.POWERED_RAIL)
.blockstate(new ControllerRailGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.color(() -> ColorHandlers::getRedstonePower)
.tag(BlockTags.RAILS)
.item()
@ -896,8 +896,8 @@ public class AllBlocks {
public static final BlockEntry<StickerBlock> STICKER = REGISTRATE.block("sticker", StickerBlock::new)
.initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque)
.addLayer(() -> RenderType::getCutoutMipped)
.properties(AbstractBlock.Properties::noOcclusion)
.addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
.item()
.transform(customItemModel())
@ -917,7 +917,7 @@ public class AllBlocks {
.blockstate(new SawGenerator()::generate)
.transform(StressConfigDefaults.setImpact(4.0))
.onRegister(addMovementBehaviour(new SawMovementBehaviour()))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel())
.register();
@ -954,7 +954,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::stone)
.onRegister(addMovementBehaviour(new HarvesterMovementBehaviour()))
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel())
.register();
@ -968,7 +968,7 @@ public class AllBlocks {
.register();
public static final DyedBlockList<SeatBlock> SEATS = new DyedBlockList<>(colour -> {
String colourName = colour.getString();
String colourName = colour.getSerializedName();
SeatMovementBehaviour movementBehaviour = new SeatMovementBehaviour();
return REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED))
.initialProperties(SharedProperties::wooden)
@ -980,20 +980,20 @@ public class AllBlocks {
.texture("2", p.modLoc("block/seat/side_" + colourName)));
})
.recipe((c, p) -> {
ShapedRecipeBuilder.shapedRecipe(c.get())
.patternLine("#")
.patternLine("-")
.key('#', DyeHelper.getWoolOfDye(colour))
.key('-', ItemTags.WOODEN_SLABS)
.addCriterion("has_wool", RegistrateRecipeProvider.hasItem(ItemTags.WOOL))
.build(p, Create.asResource("crafting/kinetics/" + c.getName()));
ShapedRecipeBuilder.shapedRecipe(c.get())
.patternLine("#")
.patternLine("-")
.key('#', DyeHelper.getTagOfDye(colour))
.key('-', AllItemTags.SEATS.tag)
.addCriterion("has_seat", RegistrateRecipeProvider.hasItem(AllItemTags.SEATS.tag))
.build(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_seat"));
ShapedRecipeBuilder.shaped(c.get())
.pattern("#")
.pattern("-")
.define('#', DyeHelper.getWoolOfDye(colour))
.define('-', ItemTags.WOODEN_SLABS)
.unlockedBy("has_wool", RegistrateRecipeProvider.hasItem(ItemTags.WOOL))
.save(p, Create.asResource("crafting/kinetics/" + c.getName()));
ShapedRecipeBuilder.shaped(c.get())
.pattern("#")
.pattern("-")
.define('#', DyeHelper.getTagOfDye(colour))
.define('-', AllItemTags.SEATS.tag)
.unlockedBy("has_seat", RegistrateRecipeProvider.hasItem(AllItemTags.SEATS.tag))
.save(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_seat"));
})
.onRegisterAfter(Item.class, v -> TooltipHelper.referTo(v, "block.create.seat"))
.tag(AllBlockTags.SEATS.tag)
@ -1005,7 +1005,7 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p))
.initialProperties(SharedProperties::wooden)
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProvider(false))
.tag(AllBlockTags.WINDMILL_SAILS.tag)
.tag(AllBlockTags.FAN_TRANSPARENT.tag)
@ -1014,7 +1014,7 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p))
.initialProperties(SharedProperties::wooden)
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProvider(false))
.tag(AllBlockTags.WINDMILL_SAILS.tag)
.simpleItem()
@ -1024,16 +1024,16 @@ public class AllBlocks {
if (colour == DyeColor.WHITE) {
return SAIL;
}
String colourName = colour.getString();
String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p))
.properties(Block.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.initialProperties(SharedProperties::wooden)
.blockstate((c, p) -> p.directionalBlock(c.get(), p.models()
.withExistingParent(colourName + "_sail", p.modLoc("block/white_sail"))
.texture("0", p.modLoc("block/sail/canvas_" + colourName))))
.tag(AllBlockTags.WINDMILL_SAILS.tag)
.tag(AllBlockTags.SAILS.tag)
.loot((p, b) -> p.registerDropping(b, SAIL.get()))
.loot((p, b) -> p.dropOther(b, SAIL.get()))
.register();
});
@ -1058,18 +1058,18 @@ public class AllBlocks {
public static final BlockEntry<CasingBlock> REFINED_RADIANCE_CASING =
REGISTRATE.block("refined_radiance_casing", CasingBlock::new)
.transform(BuilderTransformers.casing(AllSpriteShifts.REFINED_RADIANCE_CASING))
.properties(p -> p.luminance($ -> 12))
.properties(p -> p.lightLevel($ -> 12))
.lang("Radiant Casing")
.register();
public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER =
REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(StressConfigDefaults.setImpact(2.0))
.onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour()))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel())
.register();
@ -1078,7 +1078,7 @@ public class AllBlocks {
REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new)
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.blockstate(new SequencedGearshiftGenerator()::generate)
.item()
@ -1087,7 +1087,7 @@ public class AllBlocks {
public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::nonOpaque)
.properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact())
.blockstate(new FlywheelGenerator()::generate)
.item()
@ -1125,7 +1125,7 @@ public class AllBlocks {
.blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStates(s -> ConfiguredModel.builder()
.modelFile(AssetLookup.partialBaseModel(c, p))
.rotationX(s.get(ArmBlock.CEILING) ? 180 : 0)
.rotationX(s.getValue(ArmBlock.CEILING) ? 180 : 0)
.build()))
.transform(StressConfigDefaults.setImpact(2.0))
.item(ArmItem::new)
@ -1148,7 +1148,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new BeltFunnelGenerator("andesite", new ResourceLocation("block/polished_andesite"))::generate)
.loot((p, b) -> p.registerDropping(b, ANDESITE_FUNNEL.get()))
.loot((p, b) -> p.dropOther(b, ANDESITE_FUNNEL.get()))
.register();
public static final BlockEntry<BrassFunnelBlock> BRASS_FUNNEL =
@ -1167,7 +1167,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new BeltFunnelGenerator("brass", Create.asResource("block/brass_block"))::generate)
.loot((p, b) -> p.registerDropping(b, BRASS_FUNNEL.get()))
.loot((p, b) -> p.dropOther(b, BRASS_FUNNEL.get()))
.register();
public static final BlockEntry<BeltTunnelBlock> ANDESITE_TUNNEL =
@ -1211,9 +1211,9 @@ public class AllBlocks {
public static final BlockEntry<NixieTubeBlock> ORANGE_NIXIE_TUBE =
REGISTRATE.block("nixie_tube", p -> new NixieTubeBlock(p, DyeColor.ORANGE))
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance($ -> 5))
.properties(p -> p.lightLevel($ -> 5))
.blockstate(new NixieTubeGenerator()::generate)
.addLayer(() -> RenderType::getTranslucent)
.addLayer(() -> RenderType::translucent)
.item()
.transform(customItemModel())
.register();
@ -1221,13 +1221,13 @@ public class AllBlocks {
public static final DyedBlockList<NixieTubeBlock> NIXIE_TUBES = new DyedBlockList<>(colour -> {
if (colour == DyeColor.ORANGE)
return ORANGE_NIXIE_TUBE;
String colourName = colour.getString();
String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_nixie_tube", p -> new NixieTubeBlock(p, colour))
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance($ -> 5))
.properties(p -> p.lightLevel($ -> 5))
.blockstate(new NixieTubeGenerator()::generate)
.loot((p, b) -> p.registerDropping(b, ORANGE_NIXIE_TUBE.get()))
.addLayer(() -> RenderType::getTranslucent)
.loot((p, b) -> p.dropOther(b, ORANGE_NIXIE_TUBE.get()))
.addLayer(() -> RenderType::translucent)
.register();
});
@ -1236,7 +1236,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::wooden)
.tag(AllBlockTags.BRITTLE.tag, AllBlockTags.SAFE_NBT.tag)
.blockstate(new RedstoneLinkGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel("_", "transmitter"))
.register();
@ -1255,7 +1255,7 @@ public class AllBlocks {
REGISTRATE.block("pulse_repeater", PulseRepeaterBlock::new)
.initialProperties(() -> Blocks.REPEATER)
.blockstate(new PulseRepeaterGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel("diodes", "pulse_repeater"))
.register();
@ -1275,7 +1275,7 @@ public class AllBlocks {
.initialProperties(() -> Blocks.REPEATER)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new AdjustableRepeaterGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.model(AbstractDiodeGenerator.diodeItemModel(true))
.build()
@ -1285,7 +1285,7 @@ public class AllBlocks {
REGISTRATE.block("powered_latch", PoweredLatchBlock::new)
.initialProperties(() -> Blocks.REPEATER)
.blockstate(new PoweredLatchGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.simpleItem()
.register();
@ -1293,7 +1293,7 @@ public class AllBlocks {
REGISTRATE.block("powered_toggle_latch", ToggleLatchBlock::new)
.initialProperties(() -> Blocks.REPEATER)
.blockstate(new ToggleLatchGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.transform(customItemModel("diodes", "latch_off"))
.register();
@ -1303,7 +1303,7 @@ public class AllBlocks {
.initialProperties(() -> Blocks.LECTERN)
.blockstate((c,p) -> p.horizontalBlock(c.get(), p.models()
.getExistingFile(p.mcLoc("block/lectern"))))
.loot((lt, block) -> lt.registerDropping(block, Blocks.LECTERN))
.loot((lt, block) -> lt.dropOther(block, Blocks.LECTERN))
.register();
@ -1317,20 +1317,20 @@ public class AllBlocks {
REGISTRATE.block("copper_backtank", CopperBacktankBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.addLayer(() -> RenderType::getCutoutMipped)
.addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setImpact(4.0))
.loot((lt, block) -> {
Builder builder = LootTable.builder();
IBuilder survivesExplosion = SurvivesExplosion.builder();
lt.registerLootTable(block, builder.addLootPool(LootPool.builder()
.acceptCondition(survivesExplosion)
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(AllItems.COPPER_BACKTANK.get())
.acceptFunction(CopyName.builder(CopyName.Source.BLOCK_ENTITY))
.acceptFunction(CopyNbt.func_215881_a(CopyNbt.Source.BLOCK_ENTITY)
.func_216056_a("Air", "Air"))
.acceptFunction(CopyNbt.func_215881_a(CopyNbt.Source.BLOCK_ENTITY)
.func_216056_a("Enchantments", "Enchantments")))));
Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion();
lt.add(block, builder.withPool(LootPool.lootPool()
.when(survivesExplosion)
.setRolls(ConstantRange.exactly(1))
.add(ItemLootEntry.lootTableItem(AllItems.COPPER_BACKTANK.get())
.apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY))
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY)
.copy("Air", "Air"))
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY)
.copy("Enchantments", "Enchantments")))));
})
.register();

View file

@ -72,7 +72,7 @@ public class AllEntityTypes {
.properties(propertyBuilder)
.properties(b -> {
if (immuneToFire)
b.immuneToFire();
b.fireImmune();
})
.renderer(renderer);
}

View file

@ -23,6 +23,8 @@ import net.minecraftforge.common.Tags;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.fluids.FluidAttributes.Builder;
public class AllFluids {
private static final CreateRegistrate REGISTRATE = Create.registrate();
@ -53,7 +55,7 @@ public class AllFluids {
.explosionResistance(100f))
.tag(AllFluidTags.HONEY.tag)
.bucket()
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.build()
.register();
@ -68,7 +70,7 @@ public class AllFluids {
.slopeFindDistance(3)
.explosionResistance(100f))
.bucket()
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.build()
.register();
@ -82,18 +84,18 @@ public class AllFluids {
@OnlyIn(Dist.CLIENT)
private static void makeTranslucent(FluidEntry<?> entry) {
ForgeFlowingFluid fluid = entry.get();
RenderTypeLookup.setRenderLayer(fluid, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(fluid.getStillFluid(), RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(fluid, RenderType.translucent());
RenderTypeLookup.setRenderLayer(fluid.getSource(), RenderType.translucent());
}
@Nullable
public static BlockState getLavaInteraction(FluidState fluidState) {
Fluid fluid = fluidState.getFluid();
if (fluid.isEquivalentTo(HONEY.get()))
Fluid fluid = fluidState.getType();
if (fluid.isSame(HONEY.get()))
return fluidState.isSource() ? AllPaletteBlocks.LIMESTONE.getDefaultState()
: AllPaletteBlocks.LIMESTONE_VARIANTS.registeredBlocks.get(0)
.getDefaultState();
if (fluid.isEquivalentTo(CHOCOLATE.get()))
if (fluid.isSame(CHOCOLATE.get()))
return fluidState.isSource() ? AllPaletteBlocks.SCORIA.getDefaultState()
: AllPaletteBlocks.SCORIA_VARIANTS.registeredBlocks.get(0)
.getDefaultState();

View file

@ -108,33 +108,33 @@ public class AllItems {
.register();
public static final ItemEntry<Item> BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(6)
.saturation(0.3F)
.properties(p -> p.food(new Food.Builder().nutrition(6)
.saturationMod(0.3F)
.build()))
.lang("Bar of Chocolate")
.register();
public static final ItemEntry<Item> SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(6)
.saturation(0.8F)
.properties(p -> p.food(new Food.Builder().nutrition(6)
.saturationMod(0.8F)
.build()))
.register();
public static final ItemEntry<Item> CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(7)
.saturation(0.8F)
.properties(p -> p.food(new Food.Builder().nutrition(7)
.saturationMod(0.8F)
.build()))
.register();
public static final ItemEntry<Item> HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(8)
.saturation(0.8F)
.properties(p -> p.food(new Food.Builder().nutrition(8)
.saturationMod(0.8F)
.build()))
.register();
public static final ItemEntry<BuildersTeaItem> BUILDERS_TEA = REGISTRATE.item("builders_tea", BuildersTeaItem::new)
.tag(AllItemTags.UPRIGHT_ON_BELT.tag)
.properties(p -> p.maxStackSize(16))
.properties(p -> p.stacksTo(16))
.lang("Builder's Tea")
.register();
@ -203,7 +203,7 @@ public class AllItems {
.register();
public static final ItemEntry<GogglesItem> GOGGLES = REGISTRATE.item("goggles", GogglesItem::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.onRegister(CreateRegistrate.itemModel(() -> GogglesModel::new))
.lang("Engineer's Goggles")
.register();
@ -229,7 +229,7 @@ public class AllItems {
.register();
public static final ItemEntry<WrenchItem> WRENCH = REGISTRATE.item("wrench", WrenchItem::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> WrenchModel::new))
.model(AssetLookup.itemModelWithPartials())
.register();
@ -254,14 +254,14 @@ public class AllItems {
public static final ItemEntry<LinkedControllerItem> LINKED_CONTROLLER =
REGISTRATE.item("linked_controller", LinkedControllerItem::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> LinkedControllerModel::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<PotatoCannonItem> POTATO_CANNON =
REGISTRATE.item("potato_cannon", PotatoCannonItem::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> PotatoCannonModel::new))
.model(AssetLookup.itemModelWithPartials())
.register();
@ -325,16 +325,16 @@ public class AllItems {
}
public static final ItemEntry<Item> EMPTY_SCHEMATIC = REGISTRATE.item("empty_schematic", Item::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.register();
public static final ItemEntry<SchematicAndQuillItem> SCHEMATIC_AND_QUILL =
REGISTRATE.item("schematic_and_quill", SchematicAndQuillItem::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.register();
public static final ItemEntry<SchematicItem> SCHEMATIC = REGISTRATE.item("schematic", SchematicItem::new)
.properties(p -> p.maxStackSize(1))
.properties(p -> p.stacksTo(1))
.register();
// Shortcuts

View file

@ -42,24 +42,24 @@ public enum AllKeys {
public boolean isPressed() {
if (!modifiable)
return isKeyDown(key);
return keybind.isKeyDown();
return keybind.isDown();
}
public String getBoundKey() {
return keybind.getBoundKeyLocalizedText()
return keybind.getTranslatedKeyMessage()
.getString()
.toUpperCase();
}
public int getBoundCode() {
return keybind.getKey()
.getKeyCode();
.getValue();
}
public static boolean isKeyDown(int key) {
return GLFW.glfwGetKey(Minecraft.getInstance()
.getWindow()
.getHandle(), key) != 0;
.getWindow(), key) != 0;
}
public static boolean ctrlDown() {

View file

@ -54,7 +54,7 @@ public enum AllParticleTypes {
@OnlyIn(Dist.CLIENT)
public static void registerFactories(ParticleFactoryRegisterEvent event) {
ParticleManager particles = Minecraft.getInstance().particles;
ParticleManager particles = Minecraft.getInstance().particleEngine;
for (AllParticleTypes particle : values())
particle.entry.registerFactory(particles);
}

View file

@ -101,6 +101,6 @@ public enum AllRecipeTypes {
public <C extends IInventory, T extends IRecipe<C>> Optional<T> find(C inv, World world) {
return world.getRecipeManager()
.getRecipe(getType(), inv, world);
.getRecipeFor(getType(), inv, world);
}
}

View file

@ -123,9 +123,9 @@ public class AllShapes {
// Internally Shared Shapes
private static final VoxelShape
PISTON_HEAD = Blocks.PISTON_HEAD.getDefaultState()
.with(DirectionalBlock.FACING, UP)
.with(PistonHeadBlock.SHORT, true)
PISTON_HEAD = Blocks.PISTON_HEAD.defaultBlockState()
.setValue(DirectionalBlock.FACING, UP)
.setValue(PistonHeadBlock.SHORT, true)
.getShape(null, null), PISTON_EXTENDED =
shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y))
.build(),
@ -159,7 +159,7 @@ public class AllShapes {
HEATER_BLOCK_SPECIAL_COLLISION_SHAPE = shape(0, 0, 0, 16, 4, 16).build(),
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16), SEAT = cuboid(0, 0, 0, 16, 8, 16),
SEAT_COLLISION = cuboid(0, 0, 0, 16, 6, 16),
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.fullCube()).erase(4, 0, 4, 12, 16, 12)
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.block()).erase(4, 0, 4, 12, 16, 12)
.build(),
TURNTABLE_SHAPE = shape(1, 4, 1, 15, 8, 15).add(5, 0, 5, 11, 4, 11)
.build(),
@ -237,7 +237,7 @@ public class AllShapes {
}
private static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) {
return Block.makeCuboidShape(x1, y1, z1, x2, y2, z2);
return Block.box(x1, y1, z1, x2, y2, z2);
}
public static class Builder {
@ -258,7 +258,7 @@ public class AllShapes {
public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
this.shape =
VoxelShapes.combineAndSimplify(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
VoxelShapes.join(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
return this;
}

View file

@ -37,78 +37,78 @@ public class AllSoundEvents {
public static final SoundEntry
SCHEMATICANNON_LAUNCH_BLOCK = create("schematicannon_launch_block").subtitle("Schematicannon fires")
.playExisting(SoundEvents.ENTITY_GENERIC_EXPLODE, .1f, 1.1f)
.playExisting(SoundEvents.GENERIC_EXPLODE, .1f, 1.1f)
.category(SoundCategory.BLOCKS)
.build(),
SCHEMATICANNON_FINISH = create("schematicannon_finish").subtitle("Schematicannon dings")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BELL, 1, .7f)
.playExisting(SoundEvents.NOTE_BLOCK_BELL, 1, .7f)
.category(SoundCategory.BLOCKS)
.build(),
DEPOT_SLIDE = create("depot_slide").subtitle("Item slides")
.playExisting(SoundEvents.BLOCK_SAND_BREAK, .125f, 1.5f)
.playExisting(SoundEvents.SAND_BREAK, .125f, 1.5f)
.category(SoundCategory.BLOCKS)
.build(),
DEPOT_PLOP = create("depot_plop").subtitle("Item lands")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM, .25f, 1.25f)
.playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .25f, 1.25f)
.category(SoundCategory.BLOCKS)
.build(),
FUNNEL_FLAP = create("funnel_flap").subtitle("Funnel Flaps")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_ROTATE_ITEM, .125f, 1.5f)
.playExisting(SoundEvents.BLOCK_WOOL_BREAK, .0425f, .75f)
.playExisting(SoundEvents.ITEM_FRAME_ROTATE_ITEM, .125f, 1.5f)
.playExisting(SoundEvents.WOOL_BREAK, .0425f, .75f)
.category(SoundCategory.BLOCKS)
.build(),
SLIME_ADDED = create("slime_added").subtitle("Slime squishes")
.playExisting(SoundEvents.BLOCK_SLIME_BLOCK_PLACE)
.playExisting(SoundEvents.SLIME_BLOCK_PLACE)
.category(SoundCategory.BLOCKS)
.build(),
MECHANICAL_PRESS_ACTIVATION = create("mechanical_press_activation").subtitle("Mechanical Press clangs")
.playExisting(SoundEvents.BLOCK_ANVIL_LAND, .125f, 1f)
.playExisting(SoundEvents.ENTITY_ITEM_BREAK, .5f, 1f)
.playExisting(SoundEvents.ANVIL_LAND, .125f, 1f)
.playExisting(SoundEvents.ITEM_BREAK, .5f, 1f)
.category(SoundCategory.BLOCKS)
.build(),
MECHANICAL_PRESS_ACTIVATION_ON_BELT =
create("mechanical_press_activation_belt").subtitle("Mechanical Press bonks")
.playExisting(SoundEvents.BLOCK_WOOL_HIT, .75f, 1f)
.playExisting(SoundEvents.ENTITY_ITEM_BREAK, .15f, .75f)
.playExisting(SoundEvents.WOOL_HIT, .75f, 1f)
.playExisting(SoundEvents.ITEM_BREAK, .15f, .75f)
.category(SoundCategory.BLOCKS)
.build(),
MIXING = create("mixing").subtitle("Mixing Noises")
.playExisting(SoundEvents.BLOCK_GILDED_BLACKSTONE_BREAK, .125f, .5f)
.playExisting(SoundEvents.BLOCK_NETHERRACK_BREAK, .125f, .5f)
.playExisting(SoundEvents.GILDED_BLACKSTONE_BREAK, .125f, .5f)
.playExisting(SoundEvents.NETHERRACK_BREAK, .125f, .5f)
.category(SoundCategory.BLOCKS)
.build(),
CRANKING = create("cranking").subtitle("Hand Crank turns")
.playExisting(SoundEvents.BLOCK_WOOD_PLACE, .075f, .5f)
.playExisting(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, .025f, .5f)
.playExisting(SoundEvents.WOOD_PLACE, .075f, .5f)
.playExisting(SoundEvents.WOODEN_BUTTON_CLICK_OFF, .025f, .5f)
.category(SoundCategory.BLOCKS)
.build(),
WORLDSHAPER_PLACE = create("worldshaper_place").subtitle("Worldshaper zaps")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BASEDRUM)
.playExisting(SoundEvents.NOTE_BLOCK_BASEDRUM)
.category(SoundCategory.PLAYERS)
.build(),
SCROLL_VALUE = create("scroll_value").subtitle("Scroll-input clicks")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_HAT, .124f, 1f)
.playExisting(SoundEvents.NOTE_BLOCK_HAT, .124f, 1f)
.category(SoundCategory.PLAYERS)
.build(),
CONFIRM = create("confirm").subtitle("Affirmative ding")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BELL, 0.5f, 0.8f)
.playExisting(SoundEvents.NOTE_BLOCK_BELL, 0.5f, 0.8f)
.category(SoundCategory.PLAYERS)
.build(),
DENY = create("deny").subtitle("Declining boop")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BASS, 1f, 0.5f)
.playExisting(SoundEvents.NOTE_BLOCK_BASS, 1f, 0.5f)
.category(SoundCategory.PLAYERS)
.build(),
@ -121,46 +121,46 @@ public class AllSoundEvents {
.build(),
POTATO_HIT = create("potato_hit").subtitle("Vegetable impacts")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_BREAK, .75f, .75f)
.playExisting(SoundEvents.BLOCK_WEEPING_VINES_BREAK, .75f, 1.25f)
.playExisting(SoundEvents.ITEM_FRAME_BREAK, .75f, .75f)
.playExisting(SoundEvents.WEEPING_VINES_BREAK, .75f, 1.25f)
.category(SoundCategory.PLAYERS)
.build(),
CONTRAPTION_ASSEMBLE = create("contraption_assemble").subtitle("Contraption moves")
.playExisting(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN, .5f, .5f)
.playExisting(SoundEvents.BLOCK_CHEST_OPEN, .045f, .74f)
.playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .5f, .5f)
.playExisting(SoundEvents.CHEST_OPEN, .045f, .74f)
.category(SoundCategory.BLOCKS)
.build(),
CONTRAPTION_DISASSEMBLE = create("contraption_disassemble").subtitle("Contraption stops")
.playExisting(SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE, .35f, .75f)
.playExisting(SoundEvents.IRON_TRAPDOOR_CLOSE, .35f, .75f)
.category(SoundCategory.BLOCKS)
.build(),
WRENCH_ROTATE = create("wrench_rotate").subtitle("Wrench used")
.playExisting(SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, .25f, 1.25f)
.playExisting(SoundEvents.WOODEN_TRAPDOOR_CLOSE, .25f, 1.25f)
.category(SoundCategory.BLOCKS)
.build(),
WRENCH_REMOVE = create("wrench_remove").subtitle("Component breaks")
.playExisting(SoundEvents.ENTITY_ITEM_PICKUP, .25f, .75f)
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT, .25f, .75f)
.playExisting(SoundEvents.ITEM_PICKUP, .25f, .75f)
.playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, .75f)
.category(SoundCategory.BLOCKS)
.build(),
CRAFTER_CLICK = create("crafter_click").subtitle("Crafter clicks")
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT, .25f, 1)
.playExisting(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN, .125f, 1)
.playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, 1)
.playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .125f, 1)
.category(SoundCategory.BLOCKS)
.build(),
CRAFTER_CRAFT = create("crafter_craft").subtitle("Crafter crafts")
.playExisting(SoundEvents.ENTITY_ITEM_BREAK, .125f, .75f)
.playExisting(SoundEvents.ITEM_BREAK, .125f, .75f)
.category(SoundCategory.BLOCKS)
.build(),
COPPER_ARMOR_EQUIP = create("copper_armor_equip").subtitle("Diving equipment clinks")
.playExisting(SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 1f, 1f)
.playExisting(SoundEvents.ARMOR_EQUIP_GOLD, 1f, 1f)
.category(SoundCategory.PLAYERS)
.build(),
@ -170,22 +170,22 @@ public class AllSoundEvents {
.build(),
CONTROLLER_CLICK = create("controller_click").subtitle("Controller clicks")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM, .35f, 1f)
.playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .35f, 1f)
.category(SoundCategory.BLOCKS)
.build(),
CONTROLLER_PUT = create("controller_put").subtitle("Controller thumps")
.playExisting(SoundEvents.ITEM_BOOK_PUT, 1f, 1f)
.playExisting(SoundEvents.BOOK_PUT, 1f, 1f)
.category(SoundCategory.BLOCKS)
.build(),
CONTROLLER_TAKE = create("controller_take").subtitle("Lectern empties")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM, 1f, 1f)
.playExisting(SoundEvents.ITEM_FRAME_REMOVE_ITEM, 1f, 1f)
.category(SoundCategory.BLOCKS)
.build(),
SAW_ACTIVATE_WOOD = create("saw_activate_wood").subtitle("Mechanical Saw activates")
.playExisting(SoundEvents.ENTITY_BOAT_PADDLE_LAND, .75f, 1.5f)
.playExisting(SoundEvents.BOAT_PADDLE_LAND, .75f, 1.5f)
.category(SoundCategory.BLOCKS)
.build(),
@ -195,27 +195,27 @@ public class AllSoundEvents {
.build(),
BLAZE_MUNCH = create("blaze_munch").subtitle("Blaze Burner munches")
.playExisting(SoundEvents.ENTITY_GENERIC_EAT, .5f, 1f)
.playExisting(SoundEvents.GENERIC_EAT, .5f, 1f)
.category(SoundCategory.BLOCKS)
.build(),
CRUSHING_1 = create("crushing_1").subtitle("Crushing noises")
.playExisting(SoundEvents.BLOCK_NETHERRACK_HIT)
.playExisting(SoundEvents.NETHERRACK_HIT)
.category(SoundCategory.BLOCKS)
.build(),
CRUSHING_2 = create("crushing_2").noSubtitle()
.playExisting(SoundEvents.BLOCK_GRAVEL_PLACE)
.playExisting(SoundEvents.GRAVEL_PLACE)
.category(SoundCategory.BLOCKS)
.build(),
CRUSHING_3 = create("crushing_3").noSubtitle()
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_BREAK)
.playExisting(SoundEvents.NETHERITE_BLOCK_BREAK)
.category(SoundCategory.BLOCKS)
.build(),
PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls")
.playExisting(SoundEvents.BLOCK_BELL_USE)
.playExisting(SoundEvents.BELL_BLOCK)
.category(SoundCategory.BLOCKS)
.build(),
@ -273,7 +273,7 @@ public class AllSoundEvents {
}
@Override
public void act(DirectoryCache cache) throws IOException {
public void run(DirectoryCache cache) throws IOException {
generate(generator.getOutputFolder(), cache);
}
@ -409,7 +409,7 @@ public class AllSoundEvents {
public void playFrom(Entity entity, float volume, float pitch) {
if (!entity.isSilent())
play(entity.world, null, entity.getBlockPos(), volume, pitch);
play(entity.level, null, entity.blockPosition(), volume, pitch);
}
public void play(World world, PlayerEntity entity, BlockPos pos, float volume, float pitch) {
@ -417,7 +417,7 @@ public class AllSoundEvents {
}
public void play(World world, PlayerEntity entity, Vector3d pos, float volume, float pitch) {
play(world, entity, pos.getX(), pos.getY(), pos.getZ(), volume, pitch);
play(world, entity, pos.x(), pos.y(), pos.z(), volume, pitch);
}
public abstract void play(World world, PlayerEntity entity, double x, double y, double z, float volume, float pitch);
@ -427,7 +427,7 @@ public class AllSoundEvents {
}
public void playAt(World world, Vector3d pos, float volume, float pitch, boolean fade) {
playAt(world, pos.getX(), pos.getY(), pos.getZ(), volume, pitch, fade);
playAt(world, pos.x(), pos.y(), pos.z(), volume, pitch, fade);
}
public abstract void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade);
@ -480,7 +480,7 @@ public class AllSoundEvents {
JsonArray list = new JsonArray();
JsonObject s = new JsonObject();
s.addProperty("name", pair.getFirst()
.getName()
.getLocation()
.toString());
s.addProperty("type", "event");
list.add(s);
@ -504,7 +504,7 @@ public class AllSoundEvents {
public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) {
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) {
Couple<Float> volPitch = pair.getSecond();
world.playSound(x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume,
world.playLocalSound(x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume,
volPitch.getSecond() * pitch, fade);
}
}
@ -551,7 +551,7 @@ public class AllSoundEvents {
@Override
public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) {
world.playSound(x, y, z, event, category, volume, pitch, fade);
world.playLocalSound(x, y, z, event, category, volume, pitch, fade);
}
}

View file

@ -24,7 +24,7 @@ public enum AllSpecialTextures {
public void bind() {
Minecraft.getInstance()
.getTextureManager()
.bindTexture(location);
.bind(location);
}
public ResourceLocation getLocation() {

View file

@ -83,7 +83,7 @@ public class AllSpriteShifts {
WoodType.CRIMSON, WoodType.WARPED
};
Arrays.stream(supportedWoodTypes)
.forEach(woodType -> WOODEN_WINDOWS.put(woodType, vertical("palettes/" + woodType.getName() + "_window")));
.forEach(woodType -> WOODEN_WINDOWS.put(woodType, vertical("palettes/" + woodType.name() + "_window")));
for (PaletteStoneVariants paletteStoneVariants : PaletteStoneVariants.values()) {
String variantName = Lang.asId(paletteStoneVariants.name());
@ -98,7 +98,7 @@ public class AllSpriteShifts {
}
for (DyeColor color : DyeColor.values()) {
String id = color.getString();
String id = color.getSerializedName();
DYED_BELTS.put(color, SpriteShifter.get("block/belt", "block/belt/" + id + "_scroll"));
DYED_OFFSET_BELTS.put(color, SpriteShifter.get("block/belt_offset", "block/belt/" + id + "_scroll"));
DYED_DIAGONAL_BELTS.put(color,

View file

@ -41,15 +41,15 @@ public class AllTags {
}
public static ITag.INamedTag<Block> forgeBlockTag(String name) {
return forgeTag(BlockTags::makeWrapperTag, name);
return forgeTag(BlockTags::bind, name);
}
public static ITag.INamedTag<Item> forgeItemTag(String name) {
return forgeTag(ItemTags::makeWrapperTag, name);
return forgeTag(ItemTags::bind, name);
}
public static ITag.INamedTag<Fluid> forgeFluidTag(String name) {
return forgeTag(FluidTags::makeWrapperTag, name);
return forgeTag(FluidTags::bind, name);
}
public static <T> ITag.INamedTag<T> forgeTag(Function<String, ITag.INamedTag<T>> wrapperFactory, String name) {
@ -95,9 +95,9 @@ public class AllTags {
}
private AllItemTags(NameSpace namespace, String path) {
tag = ItemTags.makeWrapperTag(
tag = ItemTags.bind(
new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())).toString());
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getOrCreateTagBuilder(tag));
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag));
}
public boolean matches(ItemStack stack) {
@ -105,12 +105,12 @@ public class AllTags {
}
public void add(Item... values) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getOrCreateTagBuilder(tag)
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag)
.add(values));
}
public void includeIn(AllItemTags parent) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getOrCreateTagBuilder(parent.tag)
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent.tag)
.addTag(tag));
}
}
@ -137,7 +137,7 @@ public class AllTags {
}
public boolean matches(Fluid fluid) {
return fluid != null && fluid.isIn(tag);
return fluid != null && fluid.is(tag);
}
static void loadClass() {}
@ -173,8 +173,8 @@ public class AllTags {
new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name()));
if (ModList.get()
.isLoaded(namespace.id)) {
tag = BlockTags.makeWrapperTag(id.toString());
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag));
tag = BlockTags.bind(id.toString());
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag));
} else {
tag = new EmptyNamedTag<>(id);
}
@ -186,17 +186,17 @@ public class AllTags {
}
public void includeIn(AllBlockTags parent) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(parent.tag)
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent.tag)
.addTag(tag));
}
public void includeAll(ITag.INamedTag<Block> child) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag)
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag)
.addTag(child));
}
public void add(Block... values) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag)
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag)
.add(values));
}
}

View file

@ -110,7 +110,7 @@ public class CreateClient {
IResourceManager resourceManager = Minecraft.getInstance()
.getResourceManager();
if (resourceManager instanceof IReloadableResourceManager)
((IReloadableResourceManager) resourceManager).addReloadListener(new ResourceReloadHandler());
((IReloadableResourceManager) resourceManager).registerReloadListener(new ResourceReloadHandler());
event.enqueueWork(() -> {
CopperBacktankArmorLayer.register();
@ -119,8 +119,8 @@ public class CreateClient {
public static void onTextureStitch(TextureStitchEvent.Pre event) {
if (!event.getMap()
.getId()
.equals(PlayerContainer.BLOCK_ATLAS_TEXTURE))
.location()
.equals(PlayerContainer.BLOCK_ATLAS))
return;
SpriteShifter.getAllTargetSprites()
.forEach(event::addSprite);
@ -151,10 +151,10 @@ public class CreateClient {
protected static List<ModelResourceLocation> getAllBlockStateModelLocations(Block block) {
List<ModelResourceLocation> models = new ArrayList<>();
block.getStateContainer()
.getValidStates()
block.getStateDefinition()
.getPossibleStates()
.forEach(state -> {
models.add(getBlockModelLocation(block, BlockModelShapes.getPropertyMapString(state.getValues())));
models.add(getBlockModelLocation(block, BlockModelShapes.statePropertiesToString(state.getValues())));
});
return models;
}
@ -210,21 +210,21 @@ public class CreateClient {
if (mc.player == null)
return;
if (mc.gameSettings.graphicsMode != GraphicsFanciness.FABULOUS)
if (mc.options.graphicsMode != GraphicsFanciness.FABULOUS)
return;
if (AllConfigs.CLIENT.ignoreFabulousWarning.get())
return;
IFormattableTextComponent text = TextComponentUtils.bracketed(new StringTextComponent("WARN"))
.formatted(TextFormatting.GOLD)
IFormattableTextComponent text = TextComponentUtils.wrapInSquareBrackets(new StringTextComponent("WARN"))
.withStyle(TextFormatting.GOLD)
.append(new StringTextComponent(
" Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
.styled(style -> style
.withStyle(style -> style
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click here to disable this warning"))));
mc.ingameGUI.addChatMessage(ChatType.CHAT, text, mc.player.getUniqueID());
mc.gui.handleChat(ChatType.CHAT, text, mc.player.getUUID());
}
}

View file

@ -35,13 +35,13 @@ public class DynamicTree extends AbstractBlockBreakQueue {
return;
// Play and render block break sound and particles
world.playEvent(null, 2001, startCutPos, Block.getStateId(world.getBlockState(startCutPos)));
world.levelEvent(null, 2001, startCutPos, Block.getId(world.getBlockState(startCutPos)));
// Actually breaks the tree
BranchDestructionData data = start.destroyBranchFromNode(world, startCutPos, Direction.DOWN, false, playerEntity);
// Feed all the tree drops to drop bi-consumer
data.leavesDrops.forEach(stackPos -> drop.accept(stackPos.pos.add(startCutPos), stackPos.stack));
data.leavesDrops.forEach(stackPos -> drop.accept(stackPos.pos.offset(startCutPos), stackPos.stack));
start.getLogDrops(world, startCutPos, data.species, data.woodVolume).forEach(stack -> drop.accept(startCutPos, stack));
}

View file

@ -25,7 +25,7 @@ public class ConversionRecipe extends ProcessingRecipe<RecipeWrapper> {
public static ConversionRecipe create(ItemStack from, ItemStack to) {
ResourceLocation recipeId = Create.asResource("conversion_" + counter++);
return new ProcessingRecipeBuilder<>(ConversionRecipe::new, recipeId)
.withItemIngredients(Ingredient.fromStacks(from))
.withItemIngredients(Ingredient.of(from))
.withSingleItemOutput(to)
.build();
}

View file

@ -127,7 +127,7 @@ public class CreateJEI implements IModPlugin {
.build(),
autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless)
.recipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS && r.getIngredients()
.recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
.size() > 1 && !MechanicalPressTileEntity.canCompress(r.getIngredients()),
BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
@ -153,7 +153,7 @@ public class CreateJEI implements IModPlugin {
woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS))
.recipeList(() -> CondensedBlockCuttingRecipe
.condenseRecipes(findRecipesByType(SawTileEntity.woodcuttingRecipeType.getValue())))
.condenseRecipes(findRecipesByType(SawTileEntity.woodcuttingRecipeType.get())))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get()
.isLoaded("druidcraft"))
@ -202,7 +202,7 @@ public class CreateJEI implements IModPlugin {
.build(),
autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new)
.recipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS && r.getIngredients()
.recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
.size() == 1)
.recipes(
r -> (r.getType() == IRecipeType.CRAFTING && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.type)
@ -359,7 +359,7 @@ public class CreateJEI implements IModPlugin {
}
public static List<IRecipe<?>> findRecipes(Predicate<IRecipe<?>> predicate) {
return Minecraft.getInstance().world.getRecipeManager()
return Minecraft.getInstance().level.getRecipeManager()
.getRecipes()
.stream()
.filter(predicate)
@ -396,7 +396,7 @@ public class CreateJEI implements IModPlugin {
public static boolean doInputsMatch(IRecipe<?> recipe1, IRecipe<?> recipe2) {
ItemStack[] matchingStacks = recipe1.getIngredients()
.get(0)
.getMatchingStacks();
.getItems();
if (matchingStacks.length == 0)
return true;
if (recipe2.getIngredients()

View file

@ -39,26 +39,26 @@ public class DoubleItemIcon implements IDrawable {
secondaryStack = secondarySupplier.get();
}
RenderHelper.enable();
RenderHelper.turnBackOn();
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.enableDepthTest();
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0);
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(1, 1, 0);
GuiGameElement.of(primaryStack)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(10, 10, 100);
matrixStack.scale(.5f, .5f, .5f);
GuiGameElement.of(secondaryStack)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
matrixStack.pop();
matrixStack.popPose();
RenderSystem.enableBlend();
}

View file

@ -17,6 +17,8 @@ import net.minecraft.client.renderer.Rectangle2d;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import mezz.jei.api.gui.handlers.IGhostIngredientHandler.Target;
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public class GhostIngredientHandler<T extends GhostItemContainer<?>>
@ -28,7 +30,7 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
boolean isAttributeFilter = gui instanceof AttributeFilterScreen;
if (ingredient instanceof ItemStack) {
for (int i = 36; i < gui.getContainer().inventorySlots.size(); i++) {
for (int i = 36; i < gui.getMenu().slots.size(); i++) {
targets.add(new GhostTarget<>(gui, i - 36, isAttributeFilter));
// Only accept items in 1st slot. 2nd is used for functionality, don't wanna override that one
@ -61,8 +63,8 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
this.gui = gui;
this.slotIndex = slotIndex;
this.isAttributeFilter = isAttributeFilter;
Slot slot = gui.getContainer().inventorySlots.get(slotIndex + 36);
this.area = new Rectangle2d(gui.getGuiLeft() + slot.xPos, gui.getGuiTop() + slot.yPos, 16, 16);
Slot slot = gui.getMenu().slots.get(slotIndex + 36);
this.area = new Rectangle2d(gui.getGuiLeft() + slot.x, gui.getGuiTop() + slot.y, 16, 16);
}
@Override
@ -74,7 +76,7 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
public void accept(I ingredient) {
ItemStack stack = ((ItemStack) ingredient).copy();
stack.setCount(1);
gui.getContainer().ghostInventory.setStackInSlot(slotIndex, stack);
gui.getMenu().ghostInventory.setStackInSlot(slotIndex, stack);
if (isAttributeFilter)
return;

View file

@ -27,7 +27,7 @@ public class ScreenResourceWrapper implements IDrawable {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
resource.bind();
AbstractGui.drawTexture(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width,
AbstractGui.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width,
resource.height, 256, 256);
}

View file

@ -51,9 +51,9 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
HeatCondition requiredHeat = recipe.getRequiredHeat();
if (!requiredHeat.testBlazeBurner(HeatLevel.NONE))
itemIngredients.add(Ingredient.fromItems(AllBlocks.BLAZE_BURNER.get()));
itemIngredients.add(Ingredient.of(AllBlocks.BLAZE_BURNER.get()));
if (!requiredHeat.testBlazeBurner(HeatLevel.KINDLED))
itemIngredients.add(Ingredient.fromItems(AllItems.BLAZE_CAKE.get()));
itemIngredients.add(Ingredient.of(AllItems.BLAZE_CAKE.get()));
ingredients.setInputIngredients(itemIngredients);
ingredients.setInputLists(VanillaTypes.FLUID, recipe.getFluidIngredients()
@ -62,7 +62,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
.collect(Collectors.toList()));
if (!recipe.getRollableResults()
.isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
if (!recipe.getFluidResults()
.isEmpty())
ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults());
@ -97,7 +97,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
Ingredient ingredient = pair.getFirst();
MutableInt amount = pair.getSecond();
for (ItemStack itemStack : ingredient.getMatchingStacks()) {
for (ItemStack itemStack : ingredient.getItems()) {
ItemStack stack = itemStack.copy();
stack.setCount(amount.getValue());
stacks.add(stack);
@ -117,7 +117,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
if (!itemOutput.isEmpty()) {
itemStacks.init(i, false, 141, 50 + yOffset);
itemStacks.set(i, recipe.getRecipeOutput()
itemStacks.set(i, recipe.getResultItem()
.getStack());
yOffset -= 19;
}
@ -165,7 +165,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
AllGuiTextures heatBar = noHeat ? AllGuiTextures.JEI_NO_HEAT_BAR : AllGuiTextures.JEI_HEAT_BAR;
heatBar.draw(matrixStack, 4, 80);
Minecraft.getInstance().fontRenderer.draw(matrixStack, Lang.translate(requiredHeat.getTranslationKey()), 9,
Minecraft.getInstance().font.draw(matrixStack, Lang.translate(requiredHeat.getTranslationKey()), 9,
86, requiredHeat.getColor());
}

View file

@ -45,7 +45,7 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
public void setRecipe(IRecipeLayout recipeLayout, CondensedBlockCuttingRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 4, 4);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getItems()));
List<List<ItemStack>> results = recipe.getCondensedOutputs();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
@ -110,19 +110,19 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
Ingredient i1 = recipe.getIngredients().get(0);
for (CondensedBlockCuttingRecipe condensedRecipe : condensed) {
if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) {
condensedRecipe.addOutput(recipe.getRecipeOutput());
condensedRecipe.addOutput(recipe.getResultItem());
continue Recipes;
}
}
CondensedBlockCuttingRecipe cr = new CondensedBlockCuttingRecipe(i1);
cr.addOutput(recipe.getRecipeOutput());
cr.addOutput(recipe.getResultItem());
condensed.add(cr);
}
return condensed;
}
@Override
public boolean isDynamic() {
public boolean isSpecial() {
return true;
}

View file

@ -105,7 +105,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
float chance = output.getChance();
if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.formatted(TextFormatting.GOLD));
.withStyle(TextFormatting.GOLD));
});
}
@ -138,7 +138,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
return;
if (fluid.getFluid()
.isEquivalentTo(AllFluids.POTION.get())) {
.isSame(AllFluids.POTION.get())) {
ITextComponent name = fluid.getDisplayName();
if (tooltip.isEmpty())
tooltip.add(0, name);
@ -152,7 +152,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
}
int amount = amounts.get(index != -1 ? 0 : slotIndex);
ITextComponent text = (Lang.translate("generic.unit.millibuckets", amount)).formatted(TextFormatting.GOLD);
ITextComponent text = (Lang.translate("generic.unit.millibuckets", amount)).withStyle(TextFormatting.GOLD);
if (tooltip.isEmpty())
tooltip.add(0, text);
else {

View file

@ -41,7 +41,7 @@ public class CrushingCategory extends CreateRecipeCategory<AbstractCrushingRecip
itemStacks.init(0, true, 50, 2);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
List<ProcessingOutput> results = recipe.getRollableResults();
int size = results.size();

View file

@ -39,7 +39,7 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
if (!recipe.getRollableResults()
.isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
}
@Override
@ -47,12 +47,12 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 26, 50);
itemStacks.set(0, Arrays.asList(recipe.getProcessedItem()
.getMatchingStacks()));
.getItems()));
itemStacks.init(1, true, 50, 4);
itemStacks.set(1, Arrays.asList(recipe.getRequiredHeldItem()
.getMatchingStacks()));
.getItems()));
itemStacks.init(2, false, 131, 50);
itemStacks.set(2, recipe.getRecipeOutput());
itemStacks.set(2, recipe.getResultItem());
}
@Override

View file

@ -21,14 +21,14 @@ public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookin
@Override
public void renderAttachedBlock(MatrixStack matrixStack) {
matrixStack.push();
matrixStack.pushPose();
GuiGameElement.of(Fluids.LAVA)
.scale(24)
.atLocal(0, 0, 2)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -21,7 +21,7 @@ public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe>
@Override
public void renderAttachedBlock(MatrixStack matrixStack) {
GuiGameElement.of(Blocks.FIRE.getDefaultState())
GuiGameElement.of(Blocks.FIRE.defaultBlockState())
.scale(24)
.atLocal(0, 0, 2)
.render(matrixStack);

View file

@ -40,7 +40,7 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
itemStacks.init(0, true, 12, 47);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1;
@ -86,14 +86,14 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
@Override
public void renderAttachedBlock(MatrixStack matrixStack) {
matrixStack.push();
matrixStack.pushPose();
GuiGameElement.of(Fluids.WATER)
.scale(24)
.atLocal(0, 0, 2)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -49,7 +49,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
.forEach(stack -> {
if (stack.getItem() instanceof PotionItem) {
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
Ingredient potion = Ingredient.fromStacks(stack);
Ingredient potion = Ingredient.of(stack);
recipes.add(new ProcessingRecipeBuilder<>(EmptyingRecipe::new, Create.asResource("potions"))
.withItemIngredients(potion)
.withFluidOutputs(fluidFromPotionItem)
@ -71,7 +71,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
if (extracted.isEmpty())
return;
Ingredient ingredient = Ingredient.fromStacks(stack);
Ingredient ingredient = Ingredient.of(stack);
ResourceLocation itemName = stack.getItem()
.getRegistryName();
ResourceLocation fluidName = extracted.getFluid()
@ -99,7 +99,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
if (!recipe.getRollableResults()
.isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
if (!recipe.getFluidResults()
.isEmpty())
ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults());
@ -112,14 +112,14 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
FluidStack fluidOutput = recipe.getResultingFluid();
List<ItemStack> matchingIngredients = Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks());
.getItems());
fluidStacks.init(0, true, 132, 8);
fluidStacks.set(0, withImprovedVisibility(fluidOutput));
itemStacks.init(0, true, 26, 7);
itemStacks.set(0, matchingIngredients);
itemStacks.init(1, false, 131, 26);
itemStacks.set(1, recipe.getRecipeOutput());
itemStacks.set(1, recipe.getResultItem());
addFluidTooltip(fluidStacks, Collections.emptyList(), ImmutableList.of(fluidOutput));
}

View file

@ -41,7 +41,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
@Override
public void setIngredients(ICraftingRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
}
@Override
@ -50,7 +50,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
NonNullList<Ingredient> recipeIngredients = recipe.getIngredients();
itemStacks.init(0, false, 133, 80);
itemStacks.set(0, recipe.getRecipeOutput()
itemStacks.set(0, recipe.getResultItem()
.getStack());
int x = getXPadding(recipe);
@ -66,7 +66,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
int yPosition = (int) (y + 1 + (i / getWidth(recipe)) * f);
itemStacks.init(i + 1, true, renderer, xPosition, yPosition, slotSize, slotSize, 0, 0);
itemStacks.set(i + 1, Arrays.asList(recipeIngredients.get(i)
.getMatchingStacks()));
.getItems()));
}
}
@ -97,7 +97,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
@Override
public void draw(ICraftingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
matrixStack.push();
matrixStack.pushPose();
float scale = getScale(recipe);
matrixStack.translate(getXPadding(recipe), getYPadding(recipe), 0);
@ -105,24 +105,24 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
for (int col = 0; col < getWidth(recipe); col++)
if (!recipe.getIngredients()
.get(row * getWidth(recipe) + col)
.hasNoMatchingItems()) {
matrixStack.push();
.isEmpty()) {
matrixStack.pushPose();
matrixStack.translate(col * 19 * scale, row * 19 * scale, 0);
matrixStack.scale(scale, scale, scale);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 0, 0);
matrixStack.pop();
matrixStack.popPose();
}
matrixStack.pop();
matrixStack.popPose();
AllGuiTextures.JEI_SLOT.draw(matrixStack, 133, 80);
AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 128, 59);
crafter.draw(matrixStack, 129, 25);
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(0, 0, 300);
RenderHelper.disableStandardItemLighting();
RenderHelper.turnOff();
int amount = 0;
for (Ingredient ingredient : recipe.getIngredients()) {
if (Ingredient.EMPTY == ingredient)
@ -130,8 +130,8 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
amount++;
}
Minecraft.getInstance().fontRenderer.drawWithShadow(matrixStack, amount + "", 142, 39, 0xFFFFFF);
matrixStack.pop();
Minecraft.getInstance().font.drawShadow(matrixStack, amount + "", 142, 39, 0xFFFFFF);
matrixStack.popPose();
}
@Override
@ -149,27 +149,27 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
@Override
public void render(MatrixStack matrixStack, int xPosition, int yPosition, ItemStack ingredient) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xPosition, yPosition, 0);
float scale = getScale(recipe);
matrixStack.scale(scale, scale, scale);
if (ingredient != null) {
RenderSystem.pushMatrix();
RenderSystem.multMatrix(matrixStack.peek().getModel());
RenderSystem.multMatrix(matrixStack.last().pose());
RenderSystem.enableDepthTest();
RenderHelper.enable();
RenderHelper.turnBackOn();
Minecraft minecraft = Minecraft.getInstance();
FontRenderer font = getFontRenderer(minecraft, ingredient);
ItemRenderer itemRenderer = minecraft.getItemRenderer();
itemRenderer.renderItemAndEffectIntoGUI(null, ingredient, 0, 0);
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null);
itemRenderer.renderAndDecorateItem(null, ingredient, 0, 0);
itemRenderer.renderGuiItemDecorations(font, ingredient, 0, 0, null);
RenderSystem.disableBlend();
RenderHelper.disableStandardItemLighting();
RenderHelper.turnOff();
RenderSystem.popMatrix();
}
matrixStack.pop();
matrixStack.popPose();
}
@Override
@ -177,11 +177,11 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
Minecraft minecraft = Minecraft.getInstance();
PlayerEntity player = minecraft.player;
try {
return ingredient.getTooltip(player, tooltipFlag);
return ingredient.getTooltipLines(player, tooltipFlag);
} catch (RuntimeException | LinkageError e) {
List<ITextComponent> list = new ArrayList<>();
TranslationTextComponent crash = new TranslationTextComponent("jei.tooltip.error.crash");
list.add(crash.formatted(TextFormatting.RED));
list.add(crash.withStyle(TextFormatting.RED));
return list;
}
}

View file

@ -41,7 +41,7 @@ public class MillingCategory extends CreateRecipeCategory<AbstractCrushingRecipe
itemStacks.init(0, true, 14, 8);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1;

View file

@ -47,7 +47,7 @@ public class MysteriousItemConversionCategory extends CreateRecipeCategory<Conve
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
List<ProcessingOutput> results = recipe.getRollableResults();
itemStacks.init(0, true, 26, 16);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getItems()));
itemStacks.init(1, false, 131, 16);
itemStacks.set(1, results.get(0).getStack());
}

View file

@ -55,12 +55,12 @@ public class PackingCategory extends BasinCategory {
while (i < size) {
Ingredient ingredient = ingredients2.get(i);
itemStacks.init(i, true, (rows == 2 ? 26 : 17) + (i % rows) * 19, 50 - (i / rows) * 19);
itemStacks.set(i, Arrays.asList(ingredient.getMatchingStacks()));
itemStacks.set(i, Arrays.asList(ingredient.getItems()));
i++;
}
itemStacks.init(i, false, 141, 50);
itemStacks.set(i, recipe.getRecipeOutput());
itemStacks.set(i, recipe.getResultItem());
}
@Override

View file

@ -47,7 +47,7 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
itemStacks.init(0, true, 26, 28);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
itemStacks.init(1, false, 131, 28);
itemStacks.set(1, results.get(0)
.getStack());
@ -64,7 +64,7 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
NonNullList<Ingredient> ingredients = recipe.getIngredients();
ItemStack[] matchingStacks = ingredients.get(0)
.getMatchingStacks();
.getItems();
if (matchingStacks.length == 0)
return;

View file

@ -41,7 +41,7 @@ public class PressingCategory extends CreateRecipeCategory<PressingRecipe> {
itemStacks.init(0, true, 26, 50);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
List<ProcessingOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {

View file

@ -35,12 +35,12 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
@Override
public void setIngredients(T recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
}
public static Supplier<ItemStack> getFan(String name) {
return () -> AllBlocks.ENCASED_FAN.asStack()
.setDisplayName(Lang.translate("recipe." + name + ".fan").styled(style -> style.withItalic(false)));
.setHoverName(Lang.translate("recipe." + name + ".fan").withStyle(style -> style.withItalic(false)));
}
@Override
@ -49,10 +49,10 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
itemStacks.init(0, true, 20, 47);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
itemStacks.init(1, false, 139, 47);
itemStacks.set(1, recipe.getRecipeOutput());
itemStacks.set(1, recipe.getResultItem());
}
protected void renderWidgets(MatrixStack matrixStack, T recipe, double mouseX, double mouseY) {
@ -69,10 +69,10 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
return;
renderWidgets(matrixStack, recipe, mouseX, mouseY);
matrixStack.push();
matrixStack.pushPose();
translateFan(matrixStack);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-12.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-12.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 24;
GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER)
@ -89,7 +89,7 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
.render(matrixStack);
renderAttachedBlock(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
protected void translateFan(MatrixStack matrixStack) {

View file

@ -41,7 +41,7 @@ public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> {
itemStacks.init(0, true, 43, 4);
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
.getItems()));
List<ProcessingOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {

View file

@ -58,7 +58,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
.map(FluidIngredient::getMatchingFluidStacks)
.collect(Collectors.toList()));
ingredients.setOutputs(VanillaTypes.ITEM,
ImmutableList.of(recipe.getRecipeOutput(), recipe.getTransitionalItem()));
ImmutableList.of(recipe.getResultItem(), recipe.getTransitionalItem()));
}
@Override
@ -69,9 +69,9 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
itemStacks.init(0, true, 26 + xOffset, 90);
itemStacks.set(0, Arrays.asList(recipe.getIngredient()
.getMatchingStacks()));
.getItems()));
ItemStack result = recipe.getRecipeOutput();
ItemStack result = recipe.getResultItem();
itemStacks.init(1, false, 131 + xOffset, 90);
itemStacks.set(1, result);
@ -107,7 +107,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
float chance = recipe.getOutputChance();
if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.formatted(TextFormatting.GOLD));
.withStyle(TextFormatting.GOLD));
});
}
@ -126,9 +126,9 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
@Override
public void draw(SequencedAssemblyRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
FontRenderer font = Minecraft.getInstance().fontRenderer;
FontRenderer font = Minecraft.getInstance().font;
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(0, 15, 0);
boolean singleOutput = recipe.getOutputChance() == 1;
int xOffset = singleOutput ? 0 : -7;
@ -137,23 +137,23 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52 + xOffset, 79);
if (!singleOutput) {
AllGuiTextures.JEI_CHANCE_SLOT.draw(matrixStack, 150 + xOffset, 75);
ITextComponent component = new StringTextComponent("?").formatted(TextFormatting.BOLD);
font.drawWithShadow(matrixStack, component, font.getWidth(component) / -2 + 8 + 150 + xOffset, 2 + 78,
ITextComponent component = new StringTextComponent("?").withStyle(TextFormatting.BOLD);
font.drawShadow(matrixStack, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78,
0xefefef);
}
if (recipe.getLoops() > 1) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(15, 9, 0);
RenderSystem.color4f(.65f, .65f, .65f, 1);
AllIcons.I_REFRESH.draw(matrixStack, 50 + xOffset, 75);
RenderSystem.color4f(1, 1, 1, 1);
ITextComponent repeat = new StringTextComponent("x" + recipe.getLoops());
font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888);
matrixStack.pop();
matrixStack.popPose();
}
matrixStack.pop();
matrixStack.popPose();
int width = 0;
int margin = 3;
@ -162,18 +162,18 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
width -= margin;
matrixStack.translate(width / -2 + getBackground().getWidth() / 2, 0, 0);
matrixStack.push();
matrixStack.pushPose();
List<SequencedRecipe<?>> sequence = recipe.getSequence();
for (int i = 0; i < sequence.size(); i++) {
SequencedRecipe<?> sequencedRecipe = sequence.get(i);
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
int subWidth = subCategory.getWidth();
StringTextComponent component = new StringTextComponent("" + romans[Math.min(i, 6)]);
font.draw(matrixStack, component, font.getWidth(component) / -2 + subWidth / 2, 2, 0x888888);
font.draw(matrixStack, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888);
subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i);
matrixStack.translate(subWidth + margin, 0, 0);
}
matrixStack.pop();
matrixStack.popPose();
}
@Override
@ -194,7 +194,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
float chance = recipe.getOutputChance();
tooltip.add(junk);
tooltip.add(Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100))
.formatted(TextFormatting.GOLD));
.withStyle(TextFormatting.GOLD));
return tooltip;
}
@ -224,8 +224,8 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
tooltip.add(Lang.translate("recipe.assembly.step", i + 1));
tooltip.add(sequencedRecipe.getAsAssemblyRecipe()
.getDescriptionForAssembly()
.copy()
.formatted(TextFormatting.DARK_GREEN));
.plainCopy()
.withStyle(TextFormatting.DARK_GREEN));
return tooltip;
}
relativeX -= subCategory.getWidth() + margin;
@ -244,7 +244,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
private List<Ingredient> getAllItemIngredients(SequencedAssemblyRecipe recipe) {
List<Ingredient> assemblyIngredients = new ArrayList<>();
assemblyIngredients.add(recipe.getIngredient());
assemblyIngredients.add(Ingredient.fromStacks(recipe.getTransitionalItem()));
assemblyIngredients.add(Ingredient.of(recipe.getTransitionalItem()));
recipe.addAdditionalIngredientsAndMachines(assemblyIngredients);
return assemblyIngredients;
}

View file

@ -52,7 +52,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
.forEach(stack -> {
if (stack.getItem() instanceof PotionItem) {
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
Ingredient bottle = Ingredient.fromItems(Items.GLASS_BOTTLE);
Ingredient bottle = Ingredient.of(Items.GLASS_BOTTLE);
recipes.add(new ProcessingRecipeBuilder<>(FillingRecipe::new, Create.asResource("potions"))
.withItemIngredients(bottle)
.withFluidIngredients(FluidIngredient.fromFluidStack(fluidFromPotionItem))
@ -78,12 +78,12 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
fluidCopy.setAmount(1000);
fhi.fill(fluidCopy, FluidAction.EXECUTE);
ItemStack container = fhi.getContainer();
if (container.isItemEqual(copy))
if (container.sameItem(copy))
return;
if (container.isEmpty())
return;
Ingredient bucket = Ingredient.fromStacks(stack);
Ingredient bucket = Ingredient.of(stack);
ResourceLocation itemName = stack.getItem()
.getRegistryName();
ResourceLocation fluidName = fluidCopy.getFluid()
@ -117,7 +117,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
if (!recipe.getRollableResults()
.isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
if (!recipe.getFluidResults()
.isEmpty())
ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults());
@ -130,14 +130,14 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
FluidIngredient fluidIngredient = recipe.getRequiredFluid();
List<ItemStack> matchingIngredients = Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks());
.getItems());
fluidStacks.init(0, true, 27, 32);
fluidStacks.set(0, withImprovedVisibility(fluidIngredient.getMatchingFluidStacks()));
itemStacks.init(0, true, 26, 50);
itemStacks.set(0, matchingIngredients);
itemStacks.init(1, false, 131, 50);
itemStacks.set(1, recipe.getRecipeOutput());
itemStacks.set(1, recipe.getResultItem());
addFluidTooltip(fluidStacks, ImmutableList.of(fluidIngredient), Collections.emptyList());
}

View file

@ -20,10 +20,10 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
}
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 23;
defaultBlockElement(AllBlocks.BLAZE_BURNER.getDefaultState())
@ -39,7 +39,7 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -9,7 +9,7 @@ public class AnimatedCrafter extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
@ -29,7 +29,7 @@ public class AnimatedCrafter extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -11,13 +11,13 @@ import net.minecraft.util.math.vector.Vector3f;
public class AnimatedCrushingWheels extends AnimatedKinetics {
private final BlockState wheel = AllBlocks.CRUSHING_WHEEL.getDefaultState()
.with(BlockStateProperties.AXIS, Axis.X);
.setValue(BlockStateProperties.AXIS, Axis.X);
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-22.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(-22.5f));
int scale = 22;
defaultBlockElement(wheel)
@ -31,7 +31,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -14,10 +14,10 @@ public class AnimatedDeployer extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 20;
defaultBlockElement(shaft(Axis.Z))
@ -26,15 +26,15 @@ public class AnimatedDeployer extends AnimatedKinetics {
.render(matrixStack);
defaultBlockElement(AllBlocks.DEPLOYER.getDefaultState()
.with(DeployerBlock.FACING, Direction.DOWN)
.with(DeployerBlock.AXIS_ALONG_FIRST_COORDINATE, false))
.setValue(DeployerBlock.FACING, Direction.DOWN)
.setValue(DeployerBlock.AXIS_ALONG_FIRST_COORDINATE, false))
.scale(scale)
.render(matrixStack);
float cycle = (AnimationTickHolder.getRenderTime() - offset * 8) % 30;
float offset = cycle < 10 ? cycle / 10f : cycle < 20 ? (20 - cycle) / 10f : 0;
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(0, offset * 17, 0);
defaultBlockElement(AllBlockPartials.DEPLOYER_POLE)
@ -46,14 +46,14 @@ public class AnimatedDeployer extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
defaultBlockElement(AllBlocks.DEPOT.getDefaultState())
.atLocal(0, 2, 0)
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -21,10 +21,10 @@ public class AnimatedItemDrain extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 20;
defaultBlockElement(AllBlocks.ITEM_DRAIN.getDefaultState())
@ -32,14 +32,14 @@ public class AnimatedItemDrain extends AnimatedKinetics {
.render(matrixStack);
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance()
.getBuffer());
.getBuilder());
MatrixStack ms = new MatrixStack();
ms.scale(scale, -scale, scale);
float from = 2/16f;
float to = 1f - from;
FluidRenderer.renderTiledFluidBB(fluid, from, from, from, to, 3/4f, to, buffer, ms, 0xF000F0, false);
buffer.draw();
buffer.endBatch();
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -27,7 +27,7 @@ public abstract class AnimatedKinetics implements IDrawable {
}
protected BlockState shaft(Axis axis) {
return AllBlocks.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, axis);
return AllBlocks.SHAFT.getDefaultState().setValue(BlockStateProperties.AXIS, axis);
}
protected PartialModel cogwheel() {

View file

@ -9,7 +9,7 @@ public class AnimatedMillstone extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
matrixStack.translate(-2, 18, 0);
@ -25,7 +25,7 @@ public class AnimatedMillstone extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -12,10 +12,10 @@ public class AnimatedMixer extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 23;
defaultBlockElement(cogwheel())
@ -47,7 +47,7 @@ public class AnimatedMixer extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -18,10 +18,10 @@ public class AnimatedPress extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = basin ? 20 : 24;
defaultBlockElement(shaft(Axis.Z))
@ -44,7 +44,7 @@ public class AnimatedPress extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
private float getAnimatedHeadOffset() {

View file

@ -13,12 +13,12 @@ public class AnimatedSaw extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0);
matrixStack.translate(0, 0, 200);
matrixStack.translate(2, 22, 0);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f + 90));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f + 90));
int scale = 25;
defaultBlockElement(shaft(Axis.X))
@ -27,7 +27,7 @@ public class AnimatedSaw extends AnimatedKinetics {
.render(matrixStack);
defaultBlockElement(AllBlocks.MECHANICAL_SAW.getDefaultState()
.with(SawBlock.FACING, Direction.UP))
.setValue(SawBlock.FACING, Direction.UP))
.rotateBlock(0, 0, 0)
.scale(scale)
.render(matrixStack);
@ -37,7 +37,7 @@ public class AnimatedSaw extends AnimatedKinetics {
.scale(scale)
.render(matrixStack);
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -26,10 +26,10 @@ public class AnimatedSpout extends AnimatedKinetics {
@Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push();
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 20;
defaultBlockElement(AllBlocks.SPOUT.getDefaultState())
@ -40,7 +40,7 @@ public class AnimatedSpout extends AnimatedKinetics {
float squeeze = cycle < 20 ? MathHelper.sin((float) (cycle / 20f * Math.PI)) : 0;
squeeze *= 20;
matrixStack.push();
matrixStack.pushPose();
defaultBlockElement(AllBlockPartials.SPOUT_TOP)
.scale(scale)
@ -55,7 +55,7 @@ public class AnimatedSpout extends AnimatedKinetics {
.render(matrixStack);
matrixStack.translate(0, -3 * squeeze / 32f, 0);
matrixStack.pop();
matrixStack.popPose();
defaultBlockElement(AllBlocks.DEPOT.getDefaultState())
.atLocal(0, 2, 0)
@ -63,13 +63,13 @@ public class AnimatedSpout extends AnimatedKinetics {
.render(matrixStack);
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance()
.getBuffer());
matrixStack.push();
.getBuilder());
matrixStack.pushPose();
matrixStack.scale(16, -16, 16);
float from = 2/16f;
float to = 1f - from;
FluidRenderer.renderTiledFluidBB(fluids.get(0), from, from, from, to, to, to, buffer, matrixStack, 0xF000F0, false);
matrixStack.pop();
matrixStack.popPose();
float width = 1 / 128f * squeeze;
matrixStack.translate(scale / 2f, scale * 1.5f, scale / 2f);
@ -77,9 +77,9 @@ public class AnimatedSpout extends AnimatedKinetics {
matrixStack.translate(-width / 2, 0, -width / 2);
FluidRenderer.renderTiledFluidBB(fluids.get(0), 0, -0.001f, 0, width, 2.001f, width, buffer, matrixStack, 0xF000F0,
false);
buffer.draw();
buffer.endBatch();
matrixStack.pop();
matrixStack.popPose();
}
}

View file

@ -51,11 +51,11 @@ public abstract class SequencedAssemblySubCategory {
@Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
press.offset = index;
ms.push();
ms.pushPose();
ms.translate(-5, 50, 0);
ms.scale(.6f, .6f, .6f);
press.draw(ms, getWidth() / 2, 0);
ms.pop();
ms.popPose();
}
}
@ -86,7 +86,7 @@ public abstract class SequencedAssemblySubCategory {
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
spout.offset = index;
AllGuiTextures.JEI_SLOT.draw(ms, 3, 14);
ms.push();
ms.pushPose();
ms.translate(-7, 50, 0);
ms.scale(.75f, .75f, .75f);
spout.withFluids(recipe.getRecipe()
@ -94,7 +94,7 @@ public abstract class SequencedAssemblySubCategory {
.get(0)
.getMatchingFluidStacks())
.draw(ms, getWidth() / 2, 0);
ms.pop();
ms.popPose();
}
}
@ -114,18 +114,18 @@ public abstract class SequencedAssemblySubCategory {
itemStacks.set(index, Arrays.asList(recipe.getRecipe()
.getIngredients()
.get(1)
.getMatchingStacks()));
.getItems()));
return 1;
}
@Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
deployer.offset = index;
ms.push();
ms.pushPose();
ms.translate(-7, 50, 0);
ms.scale(.75f, .75f, .75f);
deployer.draw(ms, getWidth() / 2, 0);
ms.pop();
ms.popPose();
AllGuiTextures.JEI_SLOT.draw(ms, 3, 14);
}
@ -142,11 +142,11 @@ public abstract class SequencedAssemblySubCategory {
@Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
ms.push();
ms.pushPose();
ms.translate(0, 51.5f, 0);
ms.scale(.6f, .6f, .6f);
saw.draw(ms, getWidth() / 2, 30);
ms.pop();
ms.popPose();
}
}

View file

@ -19,7 +19,7 @@ public class CreateItemGroup extends CreateItemGroupBase {
}
@Override
public ItemStack createIcon() {
public ItemStack makeIcon() {
return AllBlocks.COGWHEEL.asStack();
}

View file

@ -37,23 +37,23 @@ public class KineticDebugger {
if (te == null)
return;
World world = Minecraft.getInstance().world;
BlockPos toOutline = te.hasSource() ? te.source : te.getPos();
World world = Minecraft.getInstance().level;
BlockPos toOutline = te.hasSource() ? te.source : te.getBlockPos();
BlockState state = te.getBlockState();
VoxelShape shape = world.getBlockState(toOutline)
.getRenderShape(world, toOutline);
.getBlockSupportShape(world, toOutline);
if (te.getTheoreticalSpeed() != 0 && !shape.isEmpty())
CreateClient.OUTLINER.chaseAABB("kineticSource", shape.getBoundingBox()
.offset(toOutline))
CreateClient.OUTLINER.chaseAABB("kineticSource", shape.bounds()
.move(toOutline))
.lineWidth(1 / 16f)
.colored(te.hasSource() ? ColorHelper.colorFromLong(te.network) : 0xffcc00);
if (state.getBlock() instanceof IRotate) {
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
Vector3d vec = Vector3d.of(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
.getDirectionVec());
Vector3d center = VecHelper.getCenterOf(te.getPos());
Vector3d vec = Vector3d.atLowerCornerOf(Direction.get(AxisDirection.POSITIVE, axis)
.getNormal());
Vector3d center = VecHelper.getCenterOf(te.getBlockPos());
CreateClient.OUTLINER.showLine("rotationAxis", center.add(vec), center.subtract(vec))
.lineWidth(1 / 16f);
}
@ -61,12 +61,12 @@ public class KineticDebugger {
}
public static boolean isActive() {
return Minecraft.getInstance().gameSettings.showDebugInfo && AllConfigs.CLIENT.rainbowDebug.get();
return Minecraft.getInstance().options.renderDebug && AllConfigs.CLIENT.rainbowDebug.get();
}
public static KineticTileEntity getSelectedTE() {
RayTraceResult obj = Minecraft.getInstance().objectMouseOver;
ClientWorld world = Minecraft.getInstance().world;
RayTraceResult obj = Minecraft.getInstance().hitResult;
ClientWorld world = Minecraft.getInstance().level;
if (obj == null)
return null;
if (world == null)
@ -75,7 +75,7 @@ public class KineticDebugger {
return null;
BlockRayTraceResult ray = (BlockRayTraceResult) obj;
TileEntity te = world.getTileEntity(ray.getPos());
TileEntity te = world.getBlockEntity(ray.getBlockPos());
if (!(te instanceof KineticTileEntity))
return null;

View file

@ -89,7 +89,7 @@ public class KineticNetwork {
te.updateFromNetwork(0, 0, 0);
if (members.isEmpty()) {
TorquePropagator.networks.get(te.getWorld())
TorquePropagator.networks.get(te.getLevel())
.remove(this.id);
return;
}
@ -109,9 +109,9 @@ public class KineticNetwork {
boolean wasOverStressed = te.isOverStressed();
te.updateFromNetwork(currentCapacity, currentStress, getSize());
if (!wasOverStressed && te.isOverStressed() && te.getTheoreticalSpeed() != 0) {
AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESSED, te.getWorld(), te.getPos(), 4);
AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESSED, te.getLevel(), te.getBlockPos(), 4);
if (containsFlywheel)
AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESS_FLYWHEEL, te.getWorld(), te.getPos(), 4);
AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESS_FLYWHEEL, te.getLevel(), te.getBlockPos(), 4);
}
}
@ -147,8 +147,8 @@ public class KineticNetwork {
for (Iterator<KineticTileEntity> iterator = sources.keySet()
.iterator(); iterator.hasNext();) {
KineticTileEntity te = iterator.next();
if (te.getWorld()
.getTileEntity(te.getPos()) != te) {
if (te.getLevel()
.getBlockEntity(te.getBlockPos()) != te) {
iterator.remove();
continue;
}
@ -164,8 +164,8 @@ public class KineticNetwork {
for (Iterator<KineticTileEntity> iterator = members.keySet()
.iterator(); iterator.hasNext();) {
KineticTileEntity te = iterator.next();
if (te.getWorld()
.getTileEntity(te.getPos()) != te) {
if (te.getLevel()
.getBlockEntity(te.getBlockPos()) != te) {
iterator.remove();
continue;
}

View file

@ -51,20 +51,20 @@ public class RotationPropagator {
final IRotate definitionFrom = (IRotate) fromBlock;
final IRotate definitionTo = (IRotate) toBlock;
final BlockPos diff = to.getPos()
.subtract(from.getPos());
final Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ());
final World world = from.getWorld();
final BlockPos diff = to.getBlockPos()
.subtract(from.getBlockPos());
final Direction direction = Direction.getNearest(diff.getX(), diff.getY(), diff.getZ());
final World world = from.getLevel();
boolean alignedAxes = true;
for (Axis axis : Axis.values())
if (axis != direction.getAxis())
if (axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0)
if (axis.choose(diff.getX(), diff.getY(), diff.getZ()) != 0)
alignedAxes = false;
boolean connectedByAxis =
alignedAxes && definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction)
&& definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite());
alignedAxes && definitionFrom.hasShaftTowards(world, from.getBlockPos(), stateFrom, direction)
&& definitionTo.hasShaftTowards(world, to.getBlockPos(), stateTo, direction.getOpposite());
boolean connectedByGears = ICogWheel.isSmallCog(stateFrom)
&& ICogWheel.isSmallCog(stateTo);
@ -89,10 +89,10 @@ public class RotationPropagator {
// Large Gear <-> Large Gear
if (isLargeToLargeGear(stateFrom, stateTo, diff)) {
Axis sourceAxis = stateFrom.get(AXIS);
Axis targetAxis = stateTo.get(AXIS);
int sourceAxisDiff = sourceAxis.getCoordinate(diff.getX(), diff.getY(), diff.getZ());
int targetAxisDiff = targetAxis.getCoordinate(diff.getX(), diff.getY(), diff.getZ());
Axis sourceAxis = stateFrom.getValue(AXIS);
Axis targetAxis = stateTo.getValue(AXIS);
int sourceAxisDiff = sourceAxis.choose(diff.getX(), diff.getY(), diff.getZ());
int targetAxisDiff = targetAxis.choose(diff.getX(), diff.getY(), diff.getZ());
return sourceAxisDiff > 0 ^ targetAxisDiff > 0 ? -1 : 1;
}
@ -107,7 +107,7 @@ public class RotationPropagator {
// Gear <-> Gear
if (connectedByGears) {
if (diff.manhattanDistance(BlockPos.ZERO) != 1)
if (diff.distManhattan(BlockPos.ZERO) != 1)
return 0;
if (ICogWheel.isLargeCog(stateTo))
return 0;
@ -125,11 +125,11 @@ public class RotationPropagator {
final BlockState stateTo = to.getBlockState();
// Rotation Speed Controller <-> Large Gear
if (isLargeCogToSpeedController(stateFrom, stateTo, to.getPos()
.subtract(from.getPos())))
if (isLargeCogToSpeedController(stateFrom, stateTo, to.getBlockPos()
.subtract(from.getBlockPos())))
return SpeedControllerTileEntity.getConveyedSpeed(from, to, true);
if (isLargeCogToSpeedController(stateTo, stateFrom, from.getPos()
.subtract(to.getPos())))
if (isLargeCogToSpeedController(stateTo, stateFrom, from.getBlockPos()
.subtract(to.getBlockPos())))
return SpeedControllerTileEntity.getConveyedSpeed(to, from, false);
float rotationSpeedModifier = getRotationSpeedModifier(from, to);
@ -139,12 +139,12 @@ public class RotationPropagator {
private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) {
if (!ICogWheel.isLargeCog(from) || !ICogWheel.isLargeCog(to))
return false;
Axis fromAxis = from.get(AXIS);
Axis toAxis = to.get(AXIS);
Axis fromAxis = from.getValue(AXIS);
Axis toAxis = to.getValue(AXIS);
if (fromAxis == toAxis)
return false;
for (Axis axis : Axis.values()) {
int axisDiff = axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ());
int axisDiff = axis.choose(diff.getX(), diff.getY(), diff.getZ());
if (axis == fromAxis || axis == toAxis) {
if (axisDiff == 0)
return false;
@ -171,15 +171,15 @@ public class RotationPropagator {
}
private static boolean isLargeToSmallCog(BlockState from, BlockState to, IRotate defTo, BlockPos diff) {
Axis axisFrom = from.get(AXIS);
Axis axisFrom = from.getValue(AXIS);
if (axisFrom != defTo.getRotationAxis(to))
return false;
if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0)
if (axisFrom.choose(diff.getX(), diff.getY(), diff.getZ()) != 0)
return false;
for (Axis axis : Axis.values()) {
if (axis == axisFrom)
continue;
if (Math.abs(axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ())) != 1)
if (Math.abs(axis.choose(diff.getX(), diff.getY(), diff.getZ())) != 1)
return false;
}
return true;
@ -188,12 +188,12 @@ public class RotationPropagator {
private static boolean isLargeCogToSpeedController(BlockState from, BlockState to, BlockPos diff) {
if (!ICogWheel.isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to))
return false;
if (!diff.equals(BlockPos.ZERO.down()))
if (!diff.equals(BlockPos.ZERO.below()))
return false;
Axis axis = from.get(CogWheelBlock.AXIS);
Axis axis = from.getValue(CogWheelBlock.AXIS);
if (axis.isVertical())
return false;
if (to.get(SpeedControllerBlock.HORIZONTAL_AXIS) == axis)
if (to.getValue(SpeedControllerBlock.HORIZONTAL_AXIS) == axis)
return false;
return true;
}
@ -205,9 +205,9 @@ public class RotationPropagator {
* @param pos
*/
public static void handleAdded(World worldIn, BlockPos pos, KineticTileEntity addedTE) {
if (worldIn.isRemote)
if (worldIn.isClientSide)
return;
if (!worldIn.isBlockPresent(pos))
if (!worldIn.isLoaded(pos))
return;
propagateNewSource(addedTE);
}
@ -218,8 +218,8 @@ public class RotationPropagator {
* @param currentTE
*/
private static void propagateNewSource(KineticTileEntity currentTE) {
BlockPos pos = currentTE.getPos();
World world = currentTE.getWorld();
BlockPos pos = currentTE.getBlockPos();
World world = currentTE.getLevel();
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
float speedOfCurrent = currentTE.getTheoreticalSpeed();
@ -251,7 +251,7 @@ public class RotationPropagator {
// Neighbour faster, overpower the incoming tree
if (Math.abs(oppositeSpeed) > Math.abs(speedOfCurrent)) {
float prevSpeed = currentTE.getSpeed();
currentTE.setSource(neighbourTE.getPos());
currentTE.setSource(neighbourTE.getBlockPos());
currentTE.setSpeed(getConveyedSpeed(neighbourTE, currentTE));
currentTE.onSpeedChanged(prevSpeed);
currentTE.sendData();
@ -271,11 +271,11 @@ public class RotationPropagator {
continue;
}
if (currentTE.hasSource() && currentTE.source.equals(neighbourTE.getPos()))
if (currentTE.hasSource() && currentTE.source.equals(neighbourTE.getBlockPos()))
currentTE.removeSource();
float prevSpeed = neighbourTE.getSpeed();
neighbourTE.setSource(currentTE.getPos());
neighbourTE.setSource(currentTE.getBlockPos());
neighbourTE.setSpeed(getConveyedSpeed(currentTE, neighbourTE));
neighbourTE.onSpeedChanged(prevSpeed);
neighbourTE.sendData();
@ -289,7 +289,7 @@ public class RotationPropagator {
float prevSpeed = neighbourTE.getSpeed();
neighbourTE.setSpeed(newSpeed);
neighbourTE.setSource(currentTE.getPos());
neighbourTE.setSource(currentTE.getBlockPos());
neighbourTE.onSpeedChanged(prevSpeed);
neighbourTE.sendData();
propagateNewSource(neighbourTE);
@ -305,7 +305,7 @@ public class RotationPropagator {
* @param removedTE
*/
public static void handleRemoved(World worldIn, BlockPos pos, KineticTileEntity removedTE) {
if (worldIn.isRemote)
if (worldIn.isClientSide)
return;
if (removedTE == null)
return;
@ -316,7 +316,7 @@ public class RotationPropagator {
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
if (!(neighbourState.getBlock() instanceof IRotate))
continue;
TileEntity tileEntity = worldIn.getTileEntity(neighbourPos);
TileEntity tileEntity = worldIn.getBlockEntity(neighbourPos);
if (!(tileEntity instanceof KineticTileEntity))
continue;
@ -336,16 +336,16 @@ public class RotationPropagator {
* @param updateTE
*/
private static void propagateMissingSource(KineticTileEntity updateTE) {
final World world = updateTE.getWorld();
final World world = updateTE.getLevel();
List<KineticTileEntity> potentialNewSources = new LinkedList<>();
List<BlockPos> frontier = new LinkedList<>();
frontier.add(updateTE.getPos());
frontier.add(updateTE.getBlockPos());
BlockPos missingSource = updateTE.hasSource() ? updateTE.source : null;
while (!frontier.isEmpty()) {
final BlockPos pos = frontier.remove(0);
TileEntity tileEntity = world.getTileEntity(pos);
TileEntity tileEntity = world.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity))
continue;
final KineticTileEntity currentTE = (KineticTileEntity) tileEntity;
@ -354,7 +354,7 @@ public class RotationPropagator {
currentTE.sendData();
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
if (neighbourTE.getPos()
if (neighbourTE.getBlockPos()
.equals(missingSource))
continue;
if (!neighbourTE.hasSource())
@ -368,7 +368,7 @@ public class RotationPropagator {
if (neighbourTE.isSource())
potentialNewSources.add(neighbourTE);
frontier.add(neighbourTE.getPos());
frontier.add(neighbourTE.getBlockPos());
}
}
@ -381,14 +381,14 @@ public class RotationPropagator {
}
private static KineticTileEntity findConnectedNeighbour(KineticTileEntity currentTE, BlockPos neighbourPos) {
BlockState neighbourState = currentTE.getWorld()
BlockState neighbourState = currentTE.getLevel()
.getBlockState(neighbourPos);
if (!(neighbourState.getBlock() instanceof IRotate))
return null;
if (!neighbourState.hasTileEntity())
return null;
TileEntity neighbourTE = currentTE.getWorld()
.getTileEntity(neighbourPos);
TileEntity neighbourTE = currentTE.getLevel()
.getBlockEntity(neighbourPos);
if (!(neighbourTE instanceof KineticTileEntity))
return null;
KineticTileEntity neighbourKTE = (KineticTileEntity) neighbourTE;
@ -403,8 +403,8 @@ public class RotationPropagator {
public static boolean isConnected(KineticTileEntity from, KineticTileEntity to) {
final BlockState stateFrom = from.getBlockState();
final BlockState stateTo = to.getBlockState();
return isLargeCogToSpeedController(stateFrom, stateTo, to.getPos()
.subtract(from.getPos())) || getRotationSpeedModifier(from, to) != 0
return isLargeCogToSpeedController(stateFrom, stateTo, to.getBlockPos()
.subtract(from.getBlockPos())) || getRotationSpeedModifier(from, to) != 0
|| from.isCustomConnection(to, stateFrom, stateTo);
}
@ -423,13 +423,13 @@ public class RotationPropagator {
private static List<BlockPos> getPotentialNeighbourLocations(KineticTileEntity te) {
List<BlockPos> neighbours = new LinkedList<>();
if (!te.getWorld()
.isAreaLoaded(te.getPos(), 1))
if (!te.getLevel()
.isAreaLoaded(te.getBlockPos(), 1))
return neighbours;
for (Direction facing : Iterate.directions)
neighbours.add(te.getPos()
.offset(facing));
neighbours.add(te.getBlockPos()
.relative(facing));
BlockState blockState = te.getBlockState();
if (!(blockState.getBlock() instanceof IRotate))

View file

@ -26,7 +26,7 @@ public class TorquePropagator {
public KineticNetwork getOrCreateNetworkFor(KineticTileEntity te) {
Long id = te.network;
KineticNetwork network;
Map<Long, KineticNetwork> map = networks.get(te.getWorld());
Map<Long, KineticNetwork> map = networks.get(te.getLevel());
if (id == null)
return null;

View file

@ -12,6 +12,6 @@ public class BackHalfShaftInstance extends HalfShaftInstance {
@Override
protected Direction getShaftDirection() {
return tile.getBlockState().get(BlockStateProperties.FACING).getOpposite();
return tile.getBlockState().getValue(BlockStateProperties.FACING).getOpposite();
}
}

View file

@ -11,6 +11,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.ToolType;
import net.minecraft.block.AbstractBlock.Properties;
public class CasingBlock extends Block implements IWrenchable {
public CasingBlock(Properties p_i48440_1_) {
@ -29,7 +31,7 @@ public class CasingBlock extends Block implements IWrenchable {
@Override
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
for (ToolType toolType : player.getHeldItemMainhand().getToolTypes()) {
for (ToolType toolType : player.getMainHandItem().getToolTypes()) {
if (isToolEffective(state, toolType))
return true;
}

View file

@ -15,6 +15,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBlock {
public static final BooleanProperty AXIS_ALONG_FIRST_COORDINATE = BooleanProperty.create("axis_along_first");
@ -24,30 +26,30 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(AXIS_ALONG_FIRST_COORDINATE);
super.fillStateContainer(builder);
super.createBlockStateDefinition(builder);
}
protected Direction getFacingForPlacement(BlockItemUseContext context) {
Direction facing = context.getNearestLookingDirection()
.getOpposite();
if (context.getPlayer() != null && context.getPlayer()
.isSneaking())
.isShiftKeyDown())
facing = facing.getOpposite();
return facing;
}
protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) {
return context.getPlacementHorizontalFacing()
return context.getHorizontalDirection()
.getAxis() == Axis.X;
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing = getFacingForPlacement(context);
BlockPos pos = context.getPos();
World world = context.getWorld();
BlockPos pos = context.getClickedPos();
World world = context.getLevel();
boolean alongFirst = false;
Axis faceAxis = facing.getAxis();
@ -70,7 +72,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
for (Direction side : Iterate.horizontalDirections) {
if (!prefersConnectionTo(world, pos, side, true)
&& !prefersConnectionTo(world, pos, side.rotateY(), false))
&& !prefersConnectionTo(world, pos, side.getClockWise(), false))
continue;
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
@ -83,15 +85,15 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
alongFirst = prefferedSide.getAxis() == Axis.X;
}
return this.getDefaultState()
.with(FACING, facing)
.with(AXIS_ALONG_FIRST_COORDINATE, alongFirst);
return this.defaultBlockState()
.setValue(FACING, facing)
.setValue(AXIS_ALONG_FIRST_COORDINATE, alongFirst);
}
protected boolean prefersConnectionTo(IWorldReader reader, BlockPos pos, Direction facing, boolean shaftAxis) {
if (!shaftAxis)
return false;
BlockPos neighbourPos = pos.offset(facing);
BlockPos neighbourPos = pos.relative(facing);
BlockState blockState = reader.getBlockState(neighbourPos);
Block block = blockState.getBlock();
return block instanceof IRotate
@ -100,9 +102,9 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
@Override
public Axis getRotationAxis(BlockState state) {
Axis pistonAxis = state.get(FACING)
Axis pistonAxis = state.getValue(FACING)
.getAxis();
boolean alongFirst = state.get(AXIS_ALONG_FIRST_COORDINATE);
boolean alongFirst = state.getValue(AXIS_ALONG_FIRST_COORDINATE);
if (pistonAxis == Axis.X)
return alongFirst ? Axis.Y : Axis.Z;

View file

@ -12,6 +12,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class DirectionalKineticBlock extends KineticBlock {
public static final DirectionProperty FACING = BlockStateProperties.FACING;
@ -21,20 +23,20 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(FACING);
super.fillStateContainer(builder);
super.createBlockStateDefinition(builder);
}
public Direction getPreferredFacing(BlockItemUseContext context) {
Direction prefferedSide = null;
for (Direction side : Iterate.directions) {
BlockState blockState = context.getWorld()
.getBlockState(context.getPos()
.offset(side));
BlockState blockState = context.getLevel()
.getBlockState(context.getClickedPos()
.relative(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos()
.offset(side), blockState, side.getOpposite()))
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos()
.relative(side), blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
break;
@ -50,22 +52,22 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction preferred = getPreferredFacing(context);
if (preferred == null || (context.getPlayer() != null && context.getPlayer()
.isSneaking())) {
.isShiftKeyDown())) {
Direction nearestLookingDirection = context.getNearestLookingDirection();
return getDefaultState().with(FACING, context.getPlayer() != null && context.getPlayer()
.isSneaking() ? nearestLookingDirection : nearestLookingDirection.getOpposite());
return defaultBlockState().setValue(FACING, context.getPlayer() != null && context.getPlayer()
.isShiftKeyDown() ? nearestLookingDirection : nearestLookingDirection.getOpposite());
}
return getDefaultState().with(FACING, preferred.getOpposite());
return defaultBlockState().setValue(FACING, preferred.getOpposite());
}
@Override
public BlockState rotate(BlockState state, Rotation rot) {
return state.with(FACING, rot.rotate(state.get(FACING)));
return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
}
@Override
public BlockState mirror(BlockState state, Mirror mirrorIn) {
return state.rotate(mirrorIn.toRotation(state.get(FACING)));
return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
}
}

View file

@ -36,7 +36,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
@Override
public void setSource(BlockPos source) {
super.setSource(source);
TileEntity tileEntity = world.getTileEntity(source);
TileEntity tileEntity = level.getBlockEntity(source);
if (!(tileEntity instanceof KineticTileEntity))
return;
KineticTileEntity sourceTe = (KineticTileEntity) tileEntity;
@ -59,8 +59,8 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float stressBase = calculateAddedStressCapacity();
if (stressBase != 0 && IRotate.StressImpact.isEnabled()) {
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.goggles.generator_stats")));
tooltip.add(componentSpacing.copy().append(Lang.translate("tooltip.capacityProvided").formatted(TextFormatting.GRAY)));
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.goggles.generator_stats")));
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("tooltip.capacityProvided").withStyle(TextFormatting.GRAY)));
float speed = getTheoreticalSpeed();
if (speed != getGeneratedSpeed() && speed != 0)
@ -70,12 +70,12 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float stressTotal = stressBase * speed;
tooltip.add(
componentSpacing.copy()
componentSpacing.plainCopy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress"))
.formatted(TextFormatting.AQUA))
.withStyle(TextFormatting.AQUA))
.append(" ")
.append(Lang.translate("gui.goggles.at_current_speed").formatted(TextFormatting.DARK_GRAY)));
.append(Lang.translate("gui.goggles.at_current_speed").withStyle(TextFormatting.DARK_GRAY)));
added = true;
}
@ -87,7 +87,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float speed = getGeneratedSpeed();
float prevSpeed = this.speed;
if (world.isRemote)
if (level.isClientSide)
return;
if (prevSpeed != speed) {
@ -141,7 +141,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
// Staying below Overpowered speed
if (Math.abs(prevSpeed) >= Math.abs(speed)) {
if (Math.signum(prevSpeed) != Math.signum(speed))
world.destroyBlock(pos, true);
level.destroyBlock(worldPosition, true);
return;
}
@ -161,6 +161,6 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
}
public Long createNetworkId() {
return pos.toLong();
return worldPosition.asLong();
}
}

View file

@ -19,6 +19,6 @@ public class HalfShaftInstance extends SingleRotatingInstance {
}
protected Direction getShaftDirection() {
return blockState.get(BlockStateProperties.FACING);
return blockState.getValue(BlockStateProperties.FACING);
}
}

View file

@ -16,6 +16,8 @@ import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class HorizontalAxisKineticBlock extends KineticBlock {
public static final Property<Axis> HORIZONTAL_AXIS = BlockStateProperties.HORIZONTAL_AXIS;
@ -25,25 +27,25 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_AXIS);
super.fillStateContainer(builder);
super.createBlockStateDefinition(builder);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
Axis preferredAxis = getPreferredHorizontalAxis(context);
if (preferredAxis != null)
return this.getDefaultState().with(HORIZONTAL_AXIS, preferredAxis);
return this.getDefaultState().with(HORIZONTAL_AXIS, context.getPlacementHorizontalFacing().rotateY().getAxis());
return this.defaultBlockState().setValue(HORIZONTAL_AXIS, preferredAxis);
return this.defaultBlockState().setValue(HORIZONTAL_AXIS, context.getHorizontalDirection().getClockWise().getAxis());
}
public static Axis getPreferredHorizontalAxis(BlockItemUseContext context) {
Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getWorld().getBlockState(context.getPos().offset(side));
BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().relative(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos().offset(side),
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos().relative(side),
blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
@ -58,19 +60,19 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
@Override
public Axis getRotationAxis(BlockState state) {
return state.get(HORIZONTAL_AXIS);
return state.getValue(HORIZONTAL_AXIS);
}
@Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == state.get(HORIZONTAL_AXIS);
return face.getAxis() == state.getValue(HORIZONTAL_AXIS);
}
@Override
public BlockState rotate(BlockState state, Rotation rot) {
Axis axis = state.get(HORIZONTAL_AXIS);
return state.with(HORIZONTAL_AXIS,
rot.rotate(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)).getAxis());
Axis axis = state.getValue(HORIZONTAL_AXIS);
return state.setValue(HORIZONTAL_AXIS,
rot.rotate(Direction.get(AxisDirection.POSITIVE, axis)).getAxis());
}
@Override

View file

@ -13,6 +13,6 @@ public class HorizontalHalfShaftInstance extends HalfShaftInstance {
@Override
protected Direction getShaftDirection() {
return blockState.get(BlockStateProperties.HORIZONTAL_FACING).getOpposite();
return blockState.getValue(BlockStateProperties.HORIZONTAL_FACING).getOpposite();
}
}

View file

@ -12,6 +12,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class HorizontalKineticBlock extends KineticBlock {
public static final Property<Direction> HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
@ -21,27 +23,27 @@ public abstract class HorizontalKineticBlock extends KineticBlock {
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING);
super.fillStateContainer(builder);
super.createBlockStateDefinition(builder);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState()
.with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing()
return this.defaultBlockState()
.setValue(HORIZONTAL_FACING, context.getHorizontalDirection()
.getOpposite());
}
public Direction getPreferredHorizontalFacing(BlockItemUseContext context) {
Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getWorld()
.getBlockState(context.getPos()
.offset(side));
BlockState blockState = context.getLevel()
.getBlockState(context.getClickedPos()
.relative(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos()
.offset(side), blockState, side.getOpposite()))
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos()
.relative(side), blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
break;
@ -55,12 +57,12 @@ public abstract class HorizontalKineticBlock extends KineticBlock {
@Override
public BlockState rotate(BlockState state, Rotation rot) {
return state.with(HORIZONTAL_FACING, rot.rotate(state.get(HORIZONTAL_FACING)));
return state.setValue(HORIZONTAL_FACING, rot.rotate(state.getValue(HORIZONTAL_FACING)));
}
@Override
public BlockState mirror(BlockState state, Mirror mirrorIn) {
return state.rotate(mirrorIn.toRotation(state.get(HORIZONTAL_FACING)));
return state.rotate(mirrorIn.getRotation(state.getValue(HORIZONTAL_FACING)));
}
}

View file

@ -72,9 +72,9 @@ public interface IRotate extends IWrenchable {
level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") ");
if (overstressed)
level.formatted(TextFormatting.DARK_GRAY, TextFormatting.STRIKETHROUGH);
level.withStyle(TextFormatting.DARK_GRAY, TextFormatting.STRIKETHROUGH);
else
level.formatted(speedLevel.getTextColor());
level.withStyle(speedLevel.getTextColor());
return level;
}
@ -115,7 +115,7 @@ public interface IRotate extends IWrenchable {
level.append(String.format(" (%s%%) ", (int) (stressPercent * 100)));
return level.formatted(color);
return level.withStyle(color);
}
}

View file

@ -16,6 +16,8 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class KineticBlock extends Block implements IRotate {
protected static final Palette color = Palette.Red;
@ -31,7 +33,7 @@ public abstract class KineticBlock extends Block implements IRotate {
@Override
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
for (ToolType toolType : player.getHeldItemMainhand()
for (ToolType toolType : player.getMainHandItem()
.getToolTypes()) {
if (isToolEffective(state, toolType))
return true;
@ -45,13 +47,13 @@ public abstract class KineticBlock extends Block implements IRotate {
}
@Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
public void onPlace(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
// onBlockAdded is useless for init, as sometimes the TE gets re-instantiated
// however, if a block change occurs that does not change kinetic connections,
// we can prevent a major re-propagation here
TileEntity tileEntity = worldIn.getTileEntity(pos);
TileEntity tileEntity = worldIn.getBlockEntity(pos);
if (tileEntity instanceof KineticTileEntity) {
KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity;
kineticTileEntity.preventSpeedUpdate = 0;
@ -87,11 +89,11 @@ public abstract class KineticBlock extends Block implements IRotate {
public abstract TileEntity createTileEntity(BlockState state, IBlockReader world);
@Override
public void updateDiagonalNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) {
if (worldIn.isRemote())
public void updateIndirectNeighbourShapes(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) {
if (worldIn.isClientSide())
return;
TileEntity tileEntity = worldIn.getTileEntity(pos);
TileEntity tileEntity = worldIn.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity))
return;
KineticTileEntity kte = (KineticTileEntity) tileEntity;
@ -108,11 +110,11 @@ public abstract class KineticBlock extends Block implements IRotate {
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
if (worldIn.isRemote)
public void setPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
if (worldIn.isClientSide)
return;
TileEntity tileEntity = worldIn.getTileEntity(pos);
TileEntity tileEntity = worldIn.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity))
return;

View file

@ -24,7 +24,7 @@ public class KineticData extends BasicData {
}
public KineticData setPosition(Vector3f pos) {
return setPosition(pos.getX(), pos.getY(), pos.getZ());
return setPosition(pos.x(), pos.y(), pos.z());
}
public KineticData setPosition(float x, float y, float z) {

View file

@ -29,9 +29,9 @@ public class KineticEffectHandler {
}
public void tick() {
World world = kte.getWorld();
World world = kte.getLevel();
if (world.isRemote) {
if (world.isClientSide) {
if (overStressedTime > 0)
if (--overStressedTime == 0)
if (kte.isOverStressed()) {
@ -59,15 +59,15 @@ public class KineticEffectHandler {
}
public void spawnEffect(IParticleData particle, float maxMotion, int amount) {
World world = kte.getWorld();
World world = kte.getLevel();
if (world == null)
return;
if (!world.isRemote)
if (!world.isClientSide)
return;
Random r = world.rand;
Random r = world.random;
for (int i = 0; i < amount; i++) {
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, r, maxMotion);
Vector3d position = VecHelper.getCenterOf(kte.getPos());
Vector3d position = VecHelper.getCenterOf(kte.getBlockPos());
world.addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z);
}
}
@ -87,8 +87,8 @@ public class KineticEffectHandler {
float radius2 = kb.getParticleTargetRadius();
Axis axis = kb.getRotationAxis(state);
BlockPos pos = kte.getPos();
World world = kte.getWorld();
BlockPos pos = kte.getBlockPos();
World world = kte.getLevel();
if (axis == null)
return;
if (world == null)
@ -105,7 +105,7 @@ public class KineticEffectHandler {
AllTriggers.triggerForNearbyPlayers(AllTriggers.ROTATION, world, pos, 5);
RotationIndicatorParticleData particleData =
new RotationIndicatorParticleData(color, particleSpeed, radius1, radius2, 10, axisChar);
((ServerWorld) world).spawnParticle(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1);
((ServerWorld) world).sendParticles(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1);
}
}

View file

@ -78,7 +78,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override
public void initialize() {
if (hasNetwork() && !world.isRemote) {
if (hasNetwork() && !level.isClientSide) {
KineticNetwork network = getOrCreateNetwork();
if (!network.initialized)
network.initFromTE(capacity, stress, networkSize);
@ -90,13 +90,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override
public void tick() {
if (!world.isRemote && needsSpeedUpdate())
if (!level.isClientSide && needsSpeedUpdate())
attachKinetics();
super.tick();
effects.tick();
if (world.isRemote) {
if (level.isClientSide) {
cachedBoundingBox = null; // cache the bounding box for every frame between ticks
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio());
return;
@ -124,10 +124,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
return;
}
if (!world.isBlockPresent(source))
if (!level.isLoaded(source))
return;
TileEntity tileEntity = world.getTileEntity(source);
TileEntity tileEntity = level.getBlockEntity(source);
KineticTileEntity sourceTe =
tileEntity instanceof KineticTileEntity ? (KineticTileEntity) tileEntity : null;
if (sourceTe == null || sourceTe.speed == 0) {
@ -184,13 +184,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
}
@Override
public void remove() {
if (!world.isRemote) {
public void setRemoved() {
if (!level.isClientSide) {
if (hasNetwork())
getOrCreateNetwork().remove(this);
detachKinetics();
}
super.remove();
super.setRemoved();
}
@Override
@ -289,10 +289,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
public void setSource(BlockPos source) {
this.source = source;
if (world == null || world.isRemote)
if (level == null || level.isClientSide)
return;
TileEntity tileEntity = world.getTileEntity(source);
TileEntity tileEntity = level.getBlockEntity(source);
if (!(tileEntity instanceof KineticTileEntity)) {
removeSource();
return;
@ -339,11 +339,11 @@ public abstract class KineticTileEntity extends SmartTileEntity
public void attachKinetics() {
updateSpeed = false;
RotationPropagator.handleAdded(world, pos, this);
RotationPropagator.handleAdded(level, worldPosition, this);
}
public void detachKinetics() {
RotationPropagator.handleRemoved(world, pos, this);
RotationPropagator.handleRemoved(level, worldPosition, this);
}
public boolean isSpeedRequirementFulfilled() {
@ -362,17 +362,17 @@ public abstract class KineticTileEntity extends SmartTileEntity
}
public static void switchToBlockState(World world, BlockPos pos, BlockState state) {
if (world.isRemote)
if (world.isClientSide)
return;
TileEntity tileEntityIn = world.getTileEntity(pos);
TileEntity tileEntityIn = world.getBlockEntity(pos);
BlockState currentState = world.getBlockState(pos);
boolean isKinetic = tileEntityIn instanceof KineticTileEntity;
if (currentState == state)
return;
if (tileEntityIn == null || !isKinetic) {
world.setBlockState(pos, state, 3);
world.setBlock(pos, state, 3);
return;
}
@ -386,7 +386,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
tileEntity.removeSource();
}
world.setBlockState(pos, state, 3);
world.setBlock(pos, state, 3);
}
@Override
@ -397,27 +397,27 @@ public abstract class KineticTileEntity extends SmartTileEntity
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.stressometer.overstressed")
.formatted(GOLD)));
.withStyle(GOLD)));
ITextComponent hint = Lang.translate("gui.contraptions.network_overstressed");
List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(cutString.get(i)));
return true;
}
if (notFastEnough) {
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.speedRequirement")
.formatted(GOLD)));
.withStyle(GOLD)));
ITextComponent hint =
Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock()
.getTranslationKey()));
Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock()
.getDescriptionId()));
List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(cutString.get(i)));
return true;
}
@ -431,21 +431,21 @@ public abstract class KineticTileEntity extends SmartTileEntity
float stressAtBase = calculateStressApplied();
if (calculateStressApplied() != 0 && StressImpact.isEnabled()) {
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.goggles.kinetic_stats")));
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.stressImpact")
.formatted(TextFormatting.GRAY)));
.withStyle(TextFormatting.GRAY)));
float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed());
tooltip.add(componentSpacing.copy()
tooltip.add(componentSpacing.plainCopy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress"))
.append(" ")
.formatted(TextFormatting.AQUA))
.withStyle(TextFormatting.AQUA))
.append(Lang.translate("gui.goggles.at_current_speed")
.formatted(TextFormatting.DARK_GRAY)));
.withStyle(TextFormatting.DARK_GRAY)));
added = true;
}
@ -526,13 +526,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
return neighbours;
Axis axis = block.getRotationAxis(state);
BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1))
BlockPos.betweenClosedStream(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1))
.forEach(offset -> {
if (axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0)
if (axis.choose(offset.getX(), offset.getY(), offset.getZ()) != 0)
return;
if (offset.distanceSq(0, 0, 0, false) != BlockPos.ZERO.distanceSq(1, 1, 0, false))
if (offset.distSqr(0, 0, 0, false) != BlockPos.ZERO.distSqr(1, 1, 0, false))
return;
neighbours.add(pos.add(offset));
neighbours.add(worldPosition.offset(offset));
});
return neighbours;
}
@ -560,7 +560,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override
public void requestModelDataUpdate() {
super.requestModelDataUpdate();
if (!this.removed)
if (!this.remove)
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this));
}
@ -586,15 +586,16 @@ public abstract class KineticTileEntity extends SmartTileEntity
float pitch = MathHelper.clamp((componentSpeed / 256f) + .45f, .85f, 1f);
if (isNoisy())
SoundScapes.play(AmbienceGroup.KINETIC, pos, pitch);
SoundScapes.play(AmbienceGroup.KINETIC, worldPosition, pitch);
Block block = getBlockState().getBlock();
if (ICogWheel.isSmallCog(block) || ICogWheel.isLargeCog(block) || block instanceof GearboxBlock)
SoundScapes.play(AmbienceGroup.COG, pos, pitch);
SoundScapes.play(AmbienceGroup.COG, worldPosition, pitch);
}
protected boolean isNoisy() {
return true;
}
}

View file

@ -39,9 +39,9 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
if (Backend.getInstance().canUseInstancing(te.getWorld())) return;
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
for (RenderType type : RenderType.getBlockLayers())
for (RenderType type : RenderType.chunkBufferLayers())
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type), light);
}
@ -58,7 +58,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
}
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
float time = AnimationTickHolder.getRenderTime(te.getWorld());
float time = AnimationTickHolder.getRenderTime(te.getLevel());
float offset = getRotationOffsetForPosition(te, pos, axis);
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
return angle;
@ -66,7 +66,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te,
int light) {
final BlockPos pos = te.getPos();
final BlockPos pos = te.getBlockPos();
Axis axis = ((IRotate) te.getBlockState()
.getBlock()).getRotationAxis(te.getBlockState());
return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis), light);
@ -75,7 +75,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis,
float angle, int light) {
buffer.light(light);
buffer.rotateCentered(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis), angle);
buffer.rotateCentered(Direction.get(AxisDirection.POSITIVE, axis), angle);
int white = 0xFFFFFF;
if (KineticDebugger.isActive()) {
@ -107,7 +107,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static BlockState shaft(Axis axis) {
return AllBlocks.SHAFT.getDefaultState()
.with(BlockStateProperties.AXIS, axis);
.setValue(BlockStateProperties.AXIS, axis);
}
public static Axis getRotationAxisOf(KineticTileEntity te) {

View file

@ -90,6 +90,6 @@ public abstract class KineticTileInstance<T extends KineticTileEntity> extends T
public static BlockState shaft(Direction.Axis axis) {
return AllBlocks.SHAFT.getDefaultState()
.with(ShaftBlock.AXIS, axis);
.setValue(ShaftBlock.AXIS, axis);
}
}

View file

@ -12,14 +12,16 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Rotation;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class RotatedPillarKineticBlock extends KineticBlock {
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public RotatedPillarKineticBlock(Properties properties) {
super(properties);
this.setDefaultState(this.getDefaultState()
.with(AXIS, Direction.Axis.Y));
this.registerDefaultState(this.defaultBlockState()
.setValue(AXIS, Direction.Axis.Y));
}
@Override
@ -27,11 +29,11 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
switch (rot) {
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch (state.get(AXIS)) {
switch (state.getValue(AXIS)) {
case X:
return state.with(AXIS, Direction.Axis.Z);
return state.setValue(AXIS, Direction.Axis.Z);
case Z:
return state.with(AXIS, Direction.Axis.X);
return state.setValue(AXIS, Direction.Axis.X);
default:
return state;
}
@ -43,12 +45,12 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
public static Axis getPreferredAxis(BlockItemUseContext context) {
Axis prefferedAxis = null;
for (Direction side : Iterate.directions) {
BlockState blockState = context.getWorld()
.getBlockState(context.getPos()
.offset(side));
BlockState blockState = context.getLevel()
.getBlockState(context.getClickedPos()
.relative(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos()
.offset(side), blockState, side.getOpposite()))
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos()
.relative(side), blockState, side.getOpposite()))
if (prefferedAxis != null && prefferedAxis != side.getAxis()) {
prefferedAxis = null;
break;
@ -61,7 +63,7 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
builder.add(AXIS);
}
@ -69,12 +71,12 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
public BlockState getStateForPlacement(BlockItemUseContext context) {
Axis preferredAxis = getPreferredAxis(context);
if (preferredAxis != null && (context.getPlayer() == null || !context.getPlayer()
.isSneaking()))
return this.getDefaultState()
.with(AXIS, preferredAxis);
return this.getDefaultState()
.with(AXIS, preferredAxis != null && context.getPlayer()
.isSneaking() ? context.getFace()
.isShiftKeyDown()))
return this.defaultBlockState()
.setValue(AXIS, preferredAxis);
return this.defaultBlockState()
.setValue(AXIS, preferredAxis != null && context.getPlayer()
.isShiftKeyDown() ? context.getClickedFace()
.getAxis()
: context.getNearestLookingDirection()
.getAxis());

View file

@ -16,13 +16,13 @@ public class RotatingData extends KineticData {
}
public RotatingData setRotationAxis(Direction.Axis axis) {
Direction orientation = Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis);
setRotationAxis(orientation.getUnitVector());
Direction orientation = Direction.get(Direction.AxisDirection.POSITIVE, axis);
setRotationAxis(orientation.step());
return this;
}
public RotatingData setRotationAxis(Vector3f axis) {
setRotationAxis(axis.getX(), axis.getY(), axis.getZ());
setRotationAxis(axis.x(), axis.y(), axis.z());
return this;
}

View file

@ -12,6 +12,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.item.Item.Properties;
public class AssemblyOperatorBlockItem extends BlockItem {
public AssemblyOperatorBlockItem(Block block, Properties builder) {
@ -19,15 +21,15 @@ public class AssemblyOperatorBlockItem extends BlockItem {
}
@Override
public ActionResultType tryPlace(BlockItemUseContext context) {
BlockPos placedOnPos = context.getPos()
.offset(context.getFace()
public ActionResultType place(BlockItemUseContext context) {
BlockPos placedOnPos = context.getClickedPos()
.relative(context.getClickedFace()
.getOpposite());
BlockState placedOnState = context.getWorld()
BlockState placedOnState = context.getLevel()
.getBlockState(placedOnPos);
if (operatesOn(placedOnState)) {
if (context.getWorld()
.getBlockState(placedOnPos.up(2))
if (context.getLevel()
.getBlockState(placedOnPos.above(2))
.getMaterial()
.isReplaceable())
context = adjustContext(context, placedOnPos);
@ -35,12 +37,12 @@ public class AssemblyOperatorBlockItem extends BlockItem {
return ActionResultType.FAIL;
}
return super.tryPlace(context);
return super.place(context);
}
protected BlockItemUseContext adjustContext(BlockItemUseContext context, BlockPos placedOnPos) {
BlockPos up = placedOnPos.up(2);
return new AssemblyOperatorUseContext(context.getWorld(), context.getPlayer(), context.getHand(), context.getItem(), new BlockRayTraceResult(new Vector3d((double)up.getX() + 0.5D + (double) Direction.UP.getXOffset() * 0.5D, (double)up.getY() + 0.5D + (double) Direction.UP.getYOffset() * 0.5D, (double)up.getZ() + 0.5D + (double) Direction.UP.getZOffset() * 0.5D), Direction.UP, up, false));
BlockPos up = placedOnPos.above(2);
return new AssemblyOperatorUseContext(context.getLevel(), context.getPlayer(), context.getHand(), context.getItemInHand(), new BlockRayTraceResult(new Vector3d((double)up.getX() + 0.5D + (double) Direction.UP.getStepX() * 0.5D, (double)up.getY() + 0.5D + (double) Direction.UP.getStepY() * 0.5D, (double)up.getZ() + 0.5D + (double) Direction.UP.getStepZ() * 0.5D), Direction.UP, up, false));
}
protected boolean operatesOn(BlockState placedOnState) {

View file

@ -66,7 +66,7 @@ public class ActorData extends InstanceData {
}
public ActorData setRotationAxis(Vector3f axis) {
setRotationAxis(axis.getX(), axis.getY(), axis.getZ());
setRotationAxis(axis.x(), axis.y(), axis.z());
return this;
}
@ -79,7 +79,7 @@ public class ActorData extends InstanceData {
}
public ActorData setRotationCenter(Vector3f axis) {
setRotationCenter(axis.getX(), axis.getY(), axis.getZ());
setRotationCenter(axis.x(), axis.y(), axis.z());
return this;
}
@ -92,10 +92,10 @@ public class ActorData extends InstanceData {
}
public ActorData setLocalRotation(Quaternion q) {
this.qX = q.getX();
this.qY = q.getY();
this.qZ = q.getZ();
this.qW = q.getW();
this.qX = q.i();
this.qY = q.j();
this.qZ = q.k();
this.qW = q.r();
markDirty();
return this;
}

View file

@ -22,6 +22,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.block.AbstractBlock.Properties;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public abstract class AttachedActorBlock extends HorizontalBlock implements IWrenchable {
@ -37,41 +39,41 @@ public abstract class AttachedActorBlock extends HorizontalBlock implements IWre
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Direction direction = state.get(HORIZONTAL_FACING);
Direction direction = state.getValue(FACING);
return AllShapes.HARVESTER_BASE.get(direction);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING);
super.fillStateContainer(builder);
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(FACING);
super.createBlockStateDefinition(builder);
}
@Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
Direction direction = state.get(HORIZONTAL_FACING);
BlockPos offset = pos.offset(direction.getOpposite());
public boolean canSurvive(BlockState state, IWorldReader worldIn, BlockPos pos) {
Direction direction = state.getValue(FACING);
BlockPos offset = pos.relative(direction.getOpposite());
return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing;
if (context.getFace().getAxis().isVertical())
facing = context.getPlacementHorizontalFacing().getOpposite();
if (context.getClickedFace().getAxis().isVertical())
facing = context.getHorizontalDirection().getOpposite();
else {
BlockState blockState =
context.getWorld().getBlockState(context.getPos().offset(context.getFace().getOpposite()));
context.getLevel().getBlockState(context.getClickedPos().relative(context.getClickedFace().getOpposite()));
if (blockState.getBlock() instanceof AttachedActorBlock)
facing = blockState.get(HORIZONTAL_FACING);
facing = blockState.getValue(FACING);
else
facing = context.getFace();
facing = context.getClickedFace();
}
return getDefaultState().with(HORIZONTAL_FACING, facing);
return defaultBlockState().setValue(FACING, facing);
}
@Override
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
return false;
}

View file

@ -20,7 +20,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
@Override
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) {
double dotProduct = oldMotion.dotProduct(motion);
double dotProduct = oldMotion.dot(motion);
if (dotProduct <= 0 && (context.relativeMotion.length() != 0) || context.firstMovement)
playSound(context);
@ -41,7 +41,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
((AbstractBellBlock<?>) block).playSound(world, pos);
} else {
// Vanilla bell sound
world.playSound(null, pos, SoundEvents.BLOCK_BELL_USE,
world.playSound(null, pos, SoundEvents.BELL_BLOCK,
SoundCategory.BLOCKS, 2f, 1f);
}
}

View file

@ -77,17 +77,17 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
}
@Override
public void remove() {
if (!world.isRemote && destroyProgress != 0)
world.sendBlockBreakProgress(breakerId, breakingPos, -1);
super.remove();
public void setRemoved() {
if (!level.isClientSide && destroyProgress != 0)
level.destroyBlockProgress(breakerId, breakingPos, -1);
super.setRemoved();
}
@Override
public void tick() {
super.tick();
if (world.isRemote)
if (level.isClientSide)
return;
if (!shouldRun())
return;
@ -101,31 +101,31 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
if (ticksUntilNextProgress-- > 0)
return;
BlockState stateToBreak = world.getBlockState(breakingPos);
float blockHardness = stateToBreak.getBlockHardness(world, breakingPos);
BlockState stateToBreak = level.getBlockState(breakingPos);
float blockHardness = stateToBreak.getDestroySpeed(level, breakingPos);
if (!canBreak(stateToBreak, blockHardness)) {
if (destroyProgress != 0) {
destroyProgress = 0;
world.sendBlockBreakProgress(breakerId, breakingPos, -1);
level.destroyBlockProgress(breakerId, breakingPos, -1);
}
return;
}
float breakSpeed = getBreakSpeed();
destroyProgress += MathHelper.clamp((int) (breakSpeed / blockHardness), 1, 10 - destroyProgress);
world.playSound(null, pos, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1);
level.playSound(null, worldPosition, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1);
if (destroyProgress >= 10) {
onBlockBroken(stateToBreak);
destroyProgress = 0;
ticksUntilNextProgress = -1;
world.sendBlockBreakProgress(breakerId, breakingPos, -1);
level.destroyBlockProgress(breakerId, breakingPos, -1);
return;
}
ticksUntilNextProgress = (int) (blockHardness / breakSpeed);
world.sendBlockBreakProgress(breakerId, breakingPos, (int) destroyProgress);
level.destroyBlockProgress(breakerId, breakingPos, (int) destroyProgress);
}
public boolean canBreak(BlockState stateToBreak, float blockHardness) {
@ -138,23 +138,23 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
}
public void onBlockBroken(BlockState stateToBreak) {
FluidState FluidState = world.getFluidState(breakingPos);
world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak));
TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null;
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f);
FluidState FluidState = level.getFluidState(breakingPos);
level.levelEvent(2001, breakingPos, Block.getId(stateToBreak));
TileEntity tileentity = stateToBreak.hasTileEntity() ? level.getBlockEntity(breakingPos) : null;
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), level.random, .125f);
Block.getDrops(stateToBreak, (ServerWorld) world, breakingPos, tileentity).forEach((stack) -> {
if (!stack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)
&& !world.restoringBlockSnapshots) {
ItemEntity itementity = new ItemEntity(world, vec.x, vec.y, vec.z, stack);
itementity.setDefaultPickupDelay();
itementity.setMotion(Vector3d.ZERO);
world.addEntity(itementity);
Block.getDrops(stateToBreak, (ServerWorld) level, breakingPos, tileentity).forEach((stack) -> {
if (!stack.isEmpty() && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)
&& !level.restoringBlockSnapshots) {
ItemEntity itementity = new ItemEntity(level, vec.x, vec.y, vec.z, stack);
itementity.setDefaultPickUpDelay();
itementity.setDeltaMovement(Vector3d.ZERO);
level.addFreshEntity(itementity);
}
});
if (world instanceof ServerWorld)
stateToBreak.spawnAdditionalDrops((ServerWorld) world, breakingPos, ItemStack.EMPTY);
world.setBlockState(breakingPos, FluidState.getBlockState(), 3);
if (level instanceof ServerWorld)
stateToBreak.spawnAfterBreak((ServerWorld) level, breakingPos, ItemStack.EMPTY);
level.setBlock(breakingPos, FluidState.createLegacyBlock(), 3);
}
protected float getBreakSpeed() {

View file

@ -25,7 +25,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
@Override
public void startMoving(MovementContext context) {
if (context.world.isRemote)
if (context.world.isClientSide)
return;
context.data.putInt("BreakerId", -BlockBreakingKineticTileEntity.NEXT_BREAKER_ID.incrementAndGet());
}
@ -35,9 +35,9 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
World world = context.world;
BlockState stateVisited = world.getBlockState(pos);
if (!stateVisited.isNormalCube(world, pos))
if (!stateVisited.isRedstoneConductor(world, pos))
damageEntities(context, pos, world);
if (world.isRemote)
if (world.isClientSide)
return;
if (!canBreak(world, pos, stateVisited))
return;
@ -50,29 +50,29 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
DamageSource damageSource = getDamageSource();
if (damageSource == null && !throwsEntities())
return;
Entities: for (Entity entity : world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos))) {
Entities: for (Entity entity : world.getEntitiesOfClass(Entity.class, new AxisAlignedBB(pos))) {
if (entity instanceof ItemEntity)
continue;
if (entity instanceof AbstractContraptionEntity)
continue;
if (entity instanceof AbstractMinecartEntity)
for (Entity passenger : entity.getRecursivePassengers())
for (Entity passenger : entity.getIndirectPassengers())
if (passenger instanceof AbstractContraptionEntity
&& ((AbstractContraptionEntity) passenger).getContraption() == context.contraption)
continue Entities;
if (damageSource != null && !world.isRemote) {
if (damageSource != null && !world.isClientSide) {
float damage = (float) MathHelper.clamp(6 * Math.pow(context.relativeMotion.length(), 0.4) + 1, 2, 10);
entity.attackEntityFrom(damageSource, damage);
entity.hurt(damageSource, damage);
}
if (throwsEntities() && (world.isRemote == (entity instanceof PlayerEntity))) {
if (throwsEntities() && (world.isClientSide == (entity instanceof PlayerEntity))) {
Vector3d motionBoost = context.motion.add(0, context.motion.length() / 4f, 0);
int maxBoost = 4;
if (motionBoost.length() > maxBoost) {
motionBoost = motionBoost.subtract(motionBoost.normalize().scale(motionBoost.length() - maxBoost));
}
entity.setMotion(entity.getMotion().add(motionBoost));
entity.velocityChanged = true;
entity.setDeltaMovement(entity.getDeltaMovement().add(motionBoost));
entity.hurtMarked = true;
}
}
}
@ -88,7 +88,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
@Override
public void stopMoving(MovementContext context) {
CompoundNBT data = context.data;
if (context.world.isRemote)
if (context.world.isClientSide)
return;
if (!data.contains("BreakingPos"))
return;
@ -102,7 +102,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
data.remove("BreakingPos");
context.stall = false;
world.sendBlockBreakProgress(id, breakingPos, -1);
world.destroyBlockProgress(id, breakingPos, -1);
}
@Override
@ -129,7 +129,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
public void tickBreaker(MovementContext context) {
CompoundNBT data = context.data;
if (context.world.isRemote)
if (context.world.isClientSide)
return;
if (!data.contains("BreakingPos"))
return;
@ -149,7 +149,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
int destroyProgress = data.getInt("Progress");
int id = data.getInt("BreakerId");
BlockState stateToBreak = world.getBlockState(breakingPos);
float blockHardness = stateToBreak.getBlockHardness(world, breakingPos);
float blockHardness = stateToBreak.getDestroySpeed(world, breakingPos);
if (!canBreak(world, breakingPos, stateToBreak)) {
if (destroyProgress != 0) {
@ -157,7 +157,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
data.remove("Progress");
data.remove("TicksUntilNextProgress");
data.remove("BreakingPos");
world.sendBlockBreakProgress(id, breakingPos, -1);
world.destroyBlockProgress(id, breakingPos, -1);
}
context.stall = false;
return;
@ -168,14 +168,14 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
world.playSound(null, breakingPos, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1);
if (destroyProgress >= 10) {
world.sendBlockBreakProgress(id, breakingPos, -1);
world.destroyBlockProgress(id, breakingPos, -1);
// break falling blocks from top to bottom
BlockPos ogPos = breakingPos;
BlockState stateAbove = world.getBlockState(breakingPos.up());
BlockState stateAbove = world.getBlockState(breakingPos.above());
while (stateAbove.getBlock() instanceof FallingBlock) {
breakingPos = breakingPos.up();
stateAbove = world.getBlockState(breakingPos.up());
breakingPos = breakingPos.above();
stateAbove = world.getBlockState(breakingPos.above());
}
stateToBreak = world.getBlockState(breakingPos);
@ -191,7 +191,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
}
ticksUntilNextProgress = (int) (blockHardness / breakSpeed);
world.sendBlockBreakProgress(id, breakingPos, (int) destroyProgress);
world.destroyBlockProgress(id, breakingPos, (int) destroyProgress);
data.putInt("TicksUntilNextProgress", ticksUntilNextProgress);
data.putInt("Progress", destroyProgress);
}
@ -201,7 +201,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
}
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
float blockHardness = state.getBlockHardness(world, breakingPos);
float blockHardness = state.getDestroySpeed(world, breakingPos);
return BlockBreakingKineticTileEntity.isBreakable(state, blockHardness);
}

View file

@ -16,20 +16,20 @@ public class CampfireMovementBehaviour extends MovementBehaviour {
@Override
public void tick(MovementContext context) {
if (context.world == null || !context.world.isRemote || context.position == null
|| !context.state.get(CampfireBlock.LIT))
if (context.world == null || !context.world.isClientSide || context.position == null
|| !context.state.getValue(CampfireBlock.LIT))
return;
// Mostly copied from CampfireBlock and CampfireTileEntity
Random random = context.world.rand;
Random random = context.world.random;
if (random.nextFloat() < 0.11F) {
for (int i = 0; i < random.nextInt(2) + 2; ++i) {
context.world.addOptionalParticle(
context.state.get(CampfireBlock.SIGNAL_FIRE) ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE
context.world.addAlwaysVisibleParticle(
context.state.getValue(CampfireBlock.SIGNAL_FIRE) ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE
: ParticleTypes.CAMPFIRE_COSY_SMOKE,
true, context.position.getX() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D),
context.position.getY() + random.nextDouble() + random.nextDouble(),
context.position.getZ() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D), 0.0D, 0.07D,
true, context.position.x() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D),
context.position.y() + random.nextDouble() + random.nextDouble(),
context.position.z() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D), 0.0D, 0.07D,
0.0D);
}
}

View file

@ -26,7 +26,7 @@ public class DrillActorInstance extends ActorInstance {
BlockState state = context.state;
facing = state.get(DrillBlock.FACING);
facing = state.getValue(DrillBlock.FACING);
Direction.Axis axis = facing.getAxis();
float eulerX = AngleHelper.verticalAngle(facing);
@ -35,7 +35,7 @@ public class DrillActorInstance extends ActorInstance {
if (axis == Direction.Axis.Y)
eulerY = 0;
else
eulerY = facing.getHorizontalAngle() + ((axis == Direction.Axis.X) ? 180 : 0);
eulerY = facing.toYRot() + ((axis == Direction.Axis.X) ? 180 : 0);
drillHead = instanceMaterial.getModel(AllBlockPartials.DRILL_HEAD, state).createInstance();

View file

@ -27,10 +27,12 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.block.AbstractBlock.Properties;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTileEntity> {
public static DamageSource damageSourceDrill = new DamageSource("create.mechanical_drill").setDamageBypassesArmor();
public static DamageSource damageSourceDrill = new DamageSource("create.mechanical_drill").bypassArmor();
public DrillBlock(Properties properties) {
super(properties);
@ -42,15 +44,15 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
}
@Override
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
public void entityInside(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (entityIn instanceof ItemEntity)
return;
if (!new AxisAlignedBB(pos).shrink(.1f).intersects(entityIn.getBoundingBox()))
if (!new AxisAlignedBB(pos).deflate(.1f).intersects(entityIn.getBoundingBox()))
return;
withTileEntityDo(worldIn, pos, te -> {
if (te.getSpeed() == 0)
return;
entityIn.attackEntityFrom(damageSourceDrill, (float) getDamage(te.getSpeed()));
entityIn.hurt(damageSourceDrill, (float) getDamage(te.getSpeed()));
});
}
@ -61,7 +63,7 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return AllShapes.CASING_12PX.get(state.get(FACING));
return AllShapes.CASING_12PX.get(state.getValue(FACING));
}
@Override
@ -72,16 +74,16 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
@Override
public Axis getRotationAxis(BlockState state) {
return state.get(FACING).getAxis();
return state.getValue(FACING).getAxis();
}
@Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return face == state.get(FACING).getOpposite();
return face == state.getValue(FACING).getOpposite();
}
@Override
public PushReaction getPushReaction(BlockState state) {
public PushReaction getPistonPushReaction(BlockState state) {
return PushReaction.NORMAL;
}
@ -91,7 +93,7 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
}
@Override
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
return false;
}

View file

@ -21,7 +21,7 @@ public class DrillInstance extends SingleRotatingInstance {
@Override
protected Instancer<RotatingData> getModel() {
BlockState referenceState = tile.getBlockState();
Direction facing = referenceState.get(FACING);
Direction facing = referenceState.getValue(FACING);
return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, referenceState, facing);
}
}

View file

@ -23,14 +23,14 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override
public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(DrillBlock.FACING)
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(DrillBlock.FACING)
.getOpposite());
}
@Override
public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(DrillBlock.FACING)
.getDirectionVec()).scale(.65f);
return Vector3d.atLowerCornerOf(context.state.getValue(DrillBlock.FACING)
.getNormal()).scale(.65f);
}
@Override

View file

@ -36,7 +36,7 @@ public class DrillRenderer extends KineticTileEntityRenderer {
ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
BlockState state = context.state;
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.DRILL_HEAD, state);
Direction facing = state.get(DrillBlock.FACING);
Direction facing = state.getValue(DrillBlock.FACING);
float speed = (float) (context.contraption.stalled
|| !VecHelper.isVecPointingTowards(context.relativeMotion, facing
@ -45,7 +45,7 @@ public class DrillRenderer extends KineticTileEntityRenderer {
float angle = (float) (((time * speed) % 360));
MatrixStack m = matrices.contraptionStack;
m.push();
m.pushPose();
MatrixStacker.of(m)
.centre()
.rotateY(AngleHelper.horizontalAngle(facing))
@ -57,9 +57,9 @@ public class DrillRenderer extends KineticTileEntityRenderer {
.transform(m)
.light(matrices.entityMatrix,
ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
.renderInto(matrices.entityStack, buffer.getBuffer(RenderType.getSolid()));
.renderInto(matrices.entityStack, buffer.getBuffer(RenderType.solid()));
m.pop();
m.popPose();
}
}

View file

@ -11,7 +11,7 @@ public class DrillTileEntity extends BlockBreakingKineticTileEntity {
@Override
protected BlockPos getBreakingPos() {
return getPos().offset(getBlockState().get(DrillBlock.FACING));
return getBlockPos().relative(getBlockState().getValue(DrillBlock.FACING));
}
}

View file

@ -40,11 +40,11 @@ public class HarvesterActorInstance extends ActorInstance {
BlockState state = context.state;
facing = state.get(HORIZONTAL_FACING);
facing = state.getValue(HORIZONTAL_FACING);
harvester = instanceMaterial.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance();
horizontalAngle = facing.getHorizontalAngle() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);
horizontalAngle = facing.toYRot() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);
harvester.setBlockLight(localBlockLight());
}

View file

@ -6,6 +6,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.AbstractBlock.Properties;
public class HarvesterBlock extends AttachedActorBlock {
public HarvesterBlock(Properties p_i48377_1_) {

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.contraptions.components.actors;
import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING;
import static net.minecraft.block.HorizontalBlock.FACING;
import javax.annotation.Nullable;
@ -38,7 +38,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
@Override
public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING)
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(FACING)
.getOpposite());
}
@ -62,8 +62,8 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
@Override
public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(HORIZONTAL_FACING)
.getDirectionVec())
return Vector3d.atLowerCornerOf(context.state.getValue(FACING)
.getNormal())
.scale(.45);
}
@ -73,7 +73,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
BlockState stateVisited = world.getBlockState(pos);
boolean notCropButCuttable = false;
if (world.isRemote)
if (world.isClientSide)
return;
if (!isValidCrop(world, pos, stateVisited)) {
@ -86,14 +86,14 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
MutableBoolean seedSubtracted = new MutableBoolean(notCropButCuttable);
BlockState state = stateVisited;
BlockHelper.destroyBlock(world, pos, 1, stack -> {
if (!seedSubtracted.getValue() && stack.isItemEqual(new ItemStack(state.getBlock()))) {
if (!seedSubtracted.getValue() && stack.sameItem(new ItemStack(state.getBlock()))) {
stack.shrink(1);
seedSubtracted.setTrue();
}
dropItem(context, stack);
});
world.setBlockState(pos, cutCrop(world, pos, stateVisited));
world.setBlockAndUpdate(pos, cutCrop(world, pos, stateVisited));
}
private boolean isValidCrop(World world, BlockPos pos, BlockState state) {
@ -109,10 +109,10 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (!(property instanceof IntegerProperty))
continue;
if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName()))
.equals(BlockStateProperties.AGE_1.getName()))
continue;
if (((IntegerProperty) property).getAllowedValues()
.size() - 1 != state.get((IntegerProperty) property)
if (((IntegerProperty) property).getPossibleValues()
.size() - 1 != state.getValue((IntegerProperty) property)
.intValue())
continue;
return true;
@ -139,7 +139,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (!(property instanceof IntegerProperty))
continue;
if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName()))
.equals(BlockStateProperties.AGE_1.getName()))
continue;
return false;
}
@ -155,17 +155,17 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
Block block = state.getBlock();
if (block instanceof CropsBlock) {
CropsBlock crop = (CropsBlock) block;
return crop.withAge(0);
return crop.getStateForAge(0);
}
if (block == Blocks.SWEET_BERRY_BUSH) {
return state.with(BlockStateProperties.AGE_0_3, Integer.valueOf(1));
return state.setValue(BlockStateProperties.AGE_3, Integer.valueOf(1));
}
if (block == Blocks.SUGAR_CANE || block == Blocks.KELP) {
if (state.getFluidState()
.isEmpty())
return Blocks.AIR.getDefaultState();
return Blocks.AIR.defaultBlockState();
return state.getFluidState()
.getBlockState();
.createLegacyBlock();
}
if (state.getCollisionShape(world, pos)
.isEmpty() || block instanceof CocoaBlock) {
@ -173,17 +173,17 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (!(property instanceof IntegerProperty))
continue;
if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName()))
.equals(BlockStateProperties.AGE_1.getName()))
continue;
return state.with((IntegerProperty) property, Integer.valueOf(0));
return state.setValue((IntegerProperty) property, Integer.valueOf(0));
}
}
if (state.getFluidState()
.isEmpty())
return Blocks.AIR.getDefaultState();
return Blocks.AIR.defaultBlockState();
return state.getFluidState()
.getBlockState();
.createLegacyBlock();
}
}

View file

@ -35,16 +35,16 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
int light, int overlay) {
BlockState blockState = te.getBlockState();
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
transform(te.getWorld(), blockState.get(HarvesterBlock.HORIZONTAL_FACING), superBuffer,
transform(te.getLevel(), blockState.getValue(HarvesterBlock.FACING), superBuffer,
te.getAnimatedSpeed());
superBuffer.light(light)
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
}
public static void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
ContraptionMatrices matrices, IRenderTypeBuffer buffers) {
BlockState blockState = context.state;
Direction facing = blockState.get(HORIZONTAL_FACING);
Direction facing = blockState.getValue(HORIZONTAL_FACING);
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, facing.getOpposite())
? context.getAnimationSpeed()
@ -58,7 +58,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
superBuffer
.light(matrices.entityMatrix,
ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
.renderInto(matrices.entityStack, buffers.getBuffer(RenderType.getCutoutMipped()));
.renderInto(matrices.entityStack, buffers.getBuffer(RenderType.cutoutMipped()));
}
public static void transform(World world, Direction facing, SuperByteBuffer superBuffer, float speed) {

View file

@ -21,7 +21,7 @@ public class HarvesterTileEntity extends SyncedTileEntity {
@Override
@OnlyIn(Dist.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return RENDER_BOX.offset(pos);
return RENDER_BOX.move(worldPosition);
}
public float getAnimatedSpeed() {

View file

@ -7,6 +7,8 @@ import com.mojang.authlib.GameProfile;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraft.block.AbstractBlock.Properties;
public class PloughBlock extends AttachedActorBlock {
public PloughBlock(Properties p_i48377_1_) {

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.contraptions.components.actors;
import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING;
import static net.minecraft.block.HorizontalBlock.FACING;
import com.simibubi.create.content.contraptions.components.actors.PloughBlock.PloughFakePlayer;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
@ -31,7 +31,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override
public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING)
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(FACING)
.getOpposite());
}
@ -39,10 +39,10 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
public void visitNewPosition(MovementContext context, BlockPos pos) {
super.visitNewPosition(context, pos);
World world = context.world;
if (world.isRemote)
if (world.isClientSide)
return;
BlockPos below = pos.down();
if (!world.isBlockPresent(below))
BlockPos below = pos.below();
if (!world.isLoaded(below))
return;
Vector3d vec = VecHelper.getCenterOf(pos);
@ -52,18 +52,18 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
return;
BlockRayTraceResult ray = world
.rayTraceBlocks(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player));
.clip(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player));
if (ray.getType() != Type.BLOCK)
return;
ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray);
new ItemStack(Items.DIAMOND_HOE).onItemUse(ctx);
new ItemStack(Items.DIAMOND_HOE).useOn(ctx);
}
@Override
public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(HORIZONTAL_FACING)
.getDirectionVec()).scale(.45);
return Vector3d.atLowerCornerOf(context.state.getValue(FACING)
.getNormal()).scale(.45);
}
@Override
@ -73,7 +73,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
if (world.getBlockState(breakingPos.down())
if (world.getBlockState(breakingPos.below())
.getBlock() instanceof FarmlandBlock)
return false;
if (state.getBlock() instanceof FlowingFluidBlock)
@ -91,7 +91,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
if (brokenState.getBlock() == Blocks.SNOW && context.world instanceof ServerWorld) {
ServerWorld world = (ServerWorld) context.world;
brokenState.getDrops(new LootContext.Builder(world).withParameter(LootParameters.BLOCK_STATE, brokenState)
.withParameter(LootParameters.ORIGIN, Vector3d.ofCenter(pos))
.withParameter(LootParameters.ORIGIN, Vector3d.atCenterOf(pos))
.withParameter(LootParameters.THIS_ENTITY, getPlayer(context))
.withParameter(LootParameters.TOOL, new ItemStack(Items.IRON_SHOVEL)))
.forEach(s -> dropItem(context, s));
@ -108,7 +108,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
private PloughFakePlayer getPlayer(MovementContext context) {
if (!(context.temporaryData instanceof PloughFakePlayer) && context.world != null) {
PloughFakePlayer player = new PloughFakePlayer((ServerWorld) context.world);
player.setHeldItem(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE));
player.setItemInHand(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE));
context.temporaryData = player;
}
return (PloughFakePlayer) context.temporaryData;

View file

@ -10,6 +10,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTileEntity {
protected LazyOptional<IFluidHandler> capability;

View file

@ -18,6 +18,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.block.AbstractBlock.Properties;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class PortableStorageInterfaceBlock extends ProperDirectionalBlock
@ -57,22 +59,22 @@ public class PortableStorageInterfaceBlock extends ProperDirectionalBlock
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return getDefaultState().with(FACING, context.getNearestLookingDirection()
return defaultBlockState().setValue(FACING, context.getNearestLookingDirection()
.getOpposite());
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return AllShapes.PORTABLE_STORAGE_INTERFACE.get(state.get(FACING));
return AllShapes.PORTABLE_STORAGE_INTERFACE.get(state.getValue(FACING));
}
@Override
public boolean hasComparatorInputOverride(BlockState state) {
public boolean hasAnalogOutputSignal(BlockState state) {
return true;
}
@Override
public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
public int getAnalogOutputSignal(BlockState blockState, World worldIn, BlockPos pos) {
return getTileEntityOptional(worldIn, pos).map(te -> te.isConnected() ? 15 : 0)
.orElse(0);
}

View file

@ -26,8 +26,8 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour {
@Override
public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(PortableStorageInterfaceBlock.FACING)
.getDirectionVec()).scale(1.85f);
return Vector3d.atLowerCornerOf(context.state.getValue(PortableStorageInterfaceBlock.FACING)
.getNormal()).scale(1.85f);
}
@Override
@ -55,13 +55,13 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour {
if (psi == null)
return false;
if ((psi.isTransferring() || psi.isPowered()) && !context.world.isRemote)
if ((psi.isTransferring() || psi.isPowered()) && !context.world.isClientSide)
return false;
context.data.put(_workingPos_, NBTUtil.writeBlockPos(psi.getPos()));
if (!context.world.isRemote) {
Vector3d diff = VecHelper.getCenterOf(psi.getPos())
context.data.put(_workingPos_, NBTUtil.writeBlockPos(psi.getBlockPos()));
if (!context.world.isClientSide) {
Vector3d diff = VecHelper.getCenterOf(psi.getBlockPos())
.subtract(context.position);
diff = VecHelper.project(diff, Vector3d.of(currentFacing.getDirectionVec()));
diff = VecHelper.project(diff, Vector3d.atLowerCornerOf(currentFacing.getNormal()));
float distance = (float) (diff.length() + 1.85f - 1);
psi.startTransferringTo(context.contraption, distance);
} else {
@ -72,7 +72,7 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour {
@Override
public void tick(MovementContext context) {
if (context.world.isRemote) {
if (context.world.isClientSide) {
boolean stalled = context.contraption.stalled;
if (stalled && !context.data.contains(_workingPos_)) {
BlockPos pos = new BlockPos(context.position);
@ -117,7 +117,7 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour {
Direction facing) {
for (int i = 0; i < 2; i++) {
PortableStorageInterfaceTileEntity interfaceAt =
getStationaryInterfaceAt(world, pos.offset(facing, i), state, facing);
getStationaryInterfaceAt(world, pos.relative(facing, i), state, facing);
if (interfaceAt == null)
continue;
return interfaceAt;
@ -127,23 +127,23 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour {
private PortableStorageInterfaceTileEntity getStationaryInterfaceAt(World world, BlockPos pos, BlockState state,
Direction facing) {
TileEntity te = world.getTileEntity(pos);
TileEntity te = world.getBlockEntity(pos);
if (!(te instanceof PortableStorageInterfaceTileEntity))
return null;
BlockState blockState = world.getBlockState(pos);
if (blockState.getBlock() != state.getBlock())
return null;
if (blockState.get(PortableStorageInterfaceBlock.FACING) != facing.getOpposite())
if (blockState.getValue(PortableStorageInterfaceBlock.FACING) != facing.getOpposite())
return null;
return (PortableStorageInterfaceTileEntity) te;
}
private Optional<Direction> getCurrentFacingIfValid(MovementContext context) {
Vector3d directionVec = Vector3d.of(context.state.get(PortableStorageInterfaceBlock.FACING)
.getDirectionVec());
Vector3d directionVec = Vector3d.atLowerCornerOf(context.state.getValue(PortableStorageInterfaceBlock.FACING)
.getNormal());
directionVec = context.rotation.apply(directionVec);
Direction facingFromVector = Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
if (directionVec.distanceTo(Vector3d.of(facingFromVector.getDirectionVec())) > 1 / 2f)
Direction facingFromVector = Direction.getNearest(directionVec.x, directionVec.y, directionVec.z);
if (directionVec.distanceTo(Vector3d.atLowerCornerOf(facingFromVector.getNormal())) > 1 / 2f)
return Optional.empty();
return Optional.of(facingFromVector);
}

View file

@ -37,7 +37,7 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
IRenderTypeBuffer buffer, int light, int overlay) {
BlockState blockState = te.getBlockState();
float progress = te.getExtensionDistance(partialTicks);
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
render(blockState, te.isConnected(), progress, null, sbb -> sbb.light(light)
.renderInto(ms, vb));
}
@ -46,7 +46,7 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
BlockState blockState = context.state;
PortableStorageInterfaceTileEntity te = getTargetPSI(context);
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
float renderPartialTicks = AnimationTickHolder.getPartialTicks();
float progress = 0;
@ -70,7 +70,7 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
middle.transform(local);
top.transform(local);
}
Direction facing = blockState.get(PortableStorageInterfaceBlock.FACING);
Direction facing = blockState.getValue(PortableStorageInterfaceBlock.FACING);
rotateToFacing(middle, facing);
rotateToFacing(top, facing);
middle.translate(0, progress * 0.5f + 0.375f, 0);
@ -94,7 +94,7 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
return null;
BlockPos pos = NBTUtil.readBlockPos(context.data.getCompound(_workingPos_));
TileEntity tileEntity = context.world.getTileEntity(pos);
TileEntity tileEntity = context.world.getBlockEntity(pos);
if (!(tileEntity instanceof PortableStorageInterfaceTileEntity))
return null;

View file

@ -65,8 +65,8 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
}
boolean isConnected = isConnected();
if (wasConnected != isConnected && !world.isRemote)
markDirty();
if (wasConnected != isConnected && !level.isClientSide)
setChanged();
float progress = 0;
if (isConnected)
@ -79,8 +79,8 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
}
@Override
public void remove() {
super.remove();
public void setRemoved() {
super.setRemoved();
invalidateCapability();
}
@ -101,7 +101,7 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
}
public void neighbourChanged() {
boolean isBlockPowered = world.isBlockPowered(pos);
boolean isBlockPowered = level.hasNeighborSignal(worldPosition);
if (isBlockPowered == powered)
return;
powered = isBlockPowered;
@ -118,7 +118,7 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
@OnlyIn(Dist.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
if (cachedBoundingBox == null) {
cachedBoundingBox = super.getRenderBoundingBox().grow(2);
cachedBoundingBox = super.getRenderBoundingBox().inflate(2);
}
return cachedBoundingBox;
}

Some files were not shown because too many files have changed in this diff Show more