mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Re-attached MovementBehaviour to funnels
This commit is contained in:
parent
e493ab9ce1
commit
59339a7bcb
2 changed files with 35 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
|
import static com.simibubi.create.AllMovementBehaviours.addMovementBehaviour;
|
||||||
import static com.simibubi.create.AllTags.tagBlockAndItem;
|
import static com.simibubi.create.AllTags.tagBlockAndItem;
|
||||||
import static com.simibubi.create.content.AllSections.SCHEMATICS;
|
import static com.simibubi.create.content.AllSections.SCHEMATICS;
|
||||||
import static com.simibubi.create.foundation.data.BlockStateGen.axisBlock;
|
import static com.simibubi.create.foundation.data.BlockStateGen.axisBlock;
|
||||||
|
@ -120,6 +121,7 @@ import com.simibubi.create.content.logistics.block.funnel.BrassBeltFunnelBlock;
|
||||||
import com.simibubi.create.content.logistics.block.funnel.BrassChuteFunnelBlock;
|
import com.simibubi.create.content.logistics.block.funnel.BrassChuteFunnelBlock;
|
||||||
import com.simibubi.create.content.logistics.block.funnel.BrassFunnelBlock;
|
import com.simibubi.create.content.logistics.block.funnel.BrassFunnelBlock;
|
||||||
import com.simibubi.create.content.logistics.block.funnel.ChuteFunnelGenerator;
|
import com.simibubi.create.content.logistics.block.funnel.ChuteFunnelGenerator;
|
||||||
|
import com.simibubi.create.content.logistics.block.funnel.FunnelMovementBehaviour;
|
||||||
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock;
|
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock;
|
||||||
import com.simibubi.create.content.logistics.block.inventories.CreativeCrateBlock;
|
import com.simibubi.create.content.logistics.block.inventories.CreativeCrateBlock;
|
||||||
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmBlock;
|
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmBlock;
|
||||||
|
@ -652,7 +654,7 @@ public class AllBlocks {
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.blockstate(BlockStateGen.directionalBlockProvider(true))
|
.blockstate(BlockStateGen.directionalBlockProvider(true))
|
||||||
.transform(StressConfigDefaults.setImpact(4.0))
|
.transform(StressConfigDefaults.setImpact(4.0))
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new DrillMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new DrillMovementBehaviour()))
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
.register();
|
||||||
|
@ -661,7 +663,7 @@ public class AllBlocks {
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.blockstate(new SawGenerator()::generate)
|
.blockstate(new SawGenerator()::generate)
|
||||||
.transform(StressConfigDefaults.setImpact(4.0))
|
.transform(StressConfigDefaults.setImpact(4.0))
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new SawMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new SawMovementBehaviour()))
|
||||||
.addLayer(() -> RenderType::getCutoutMipped)
|
.addLayer(() -> RenderType::getCutoutMipped)
|
||||||
.item()
|
.item()
|
||||||
.model((c, p) -> p.blockItem(() -> c.getEntry()
|
.model((c, p) -> p.blockItem(() -> c.getEntry()
|
||||||
|
@ -673,7 +675,7 @@ public class AllBlocks {
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.blockstate(BlockStateGen.directionalAxisBlockProvider())
|
.blockstate(BlockStateGen.directionalAxisBlockProvider())
|
||||||
.transform(StressConfigDefaults.setImpact(4.0))
|
.transform(StressConfigDefaults.setImpact(4.0))
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new DeployerMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new DeployerMovementBehaviour()))
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
.register();
|
||||||
|
@ -681,7 +683,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<PortableStorageInterfaceBlock> PORTABLE_STORAGE_INTERFACE =
|
public static final BlockEntry<PortableStorageInterfaceBlock> PORTABLE_STORAGE_INTERFACE =
|
||||||
REGISTRATE.block("portable_storage_interface", PortableStorageInterfaceBlock::new)
|
REGISTRATE.block("portable_storage_interface", PortableStorageInterfaceBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new StorageInterfaceMovement()))
|
.onRegister(addMovementBehaviour(new StorageInterfaceMovement()))
|
||||||
.blockstate(BlockStateGen.directionalBlockProvider(false))
|
.blockstate(BlockStateGen.directionalBlockProvider(false))
|
||||||
.simpleItem()
|
.simpleItem()
|
||||||
.register();
|
.register();
|
||||||
|
@ -689,7 +691,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<HarvesterBlock> MECHANICAL_HARVESTER =
|
public static final BlockEntry<HarvesterBlock> MECHANICAL_HARVESTER =
|
||||||
REGISTRATE.block("mechanical_harvester", HarvesterBlock::new)
|
REGISTRATE.block("mechanical_harvester", HarvesterBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new HarvesterMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new HarvesterMovementBehaviour()))
|
||||||
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
||||||
.addLayer(() -> RenderType::getCutoutMipped)
|
.addLayer(() -> RenderType::getCutoutMipped)
|
||||||
.item()
|
.item()
|
||||||
|
@ -699,7 +701,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<PloughBlock> MECHANICAL_PLOUGH =
|
public static final BlockEntry<PloughBlock> MECHANICAL_PLOUGH =
|
||||||
REGISTRATE.block("mechanical_plough", PloughBlock::new)
|
REGISTRATE.block("mechanical_plough", PloughBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new PloughMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new PloughMovementBehaviour()))
|
||||||
.blockstate(BlockStateGen.horizontalBlockProvider(false))
|
.blockstate(BlockStateGen.horizontalBlockProvider(false))
|
||||||
.simpleItem()
|
.simpleItem()
|
||||||
.register();
|
.register();
|
||||||
|
@ -710,7 +712,7 @@ public class AllBlocks {
|
||||||
SeatMovementBehaviour movementBehaviour = new SeatMovementBehaviour();
|
SeatMovementBehaviour movementBehaviour = new SeatMovementBehaviour();
|
||||||
REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED))
|
REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED))
|
||||||
.initialProperties(SharedProperties::wooden)
|
.initialProperties(SharedProperties::wooden)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(movementBehaviour))
|
.onRegister(addMovementBehaviour(movementBehaviour))
|
||||||
.blockstate((c, p) -> {
|
.blockstate((c, p) -> {
|
||||||
p.simpleBlock(c.get(), p.models()
|
p.simpleBlock(c.get(), p.models()
|
||||||
.withExistingParent(colourName + "_seat", p.modLoc("block/seat"))
|
.withExistingParent(colourName + "_seat", p.modLoc("block/seat"))
|
||||||
|
@ -847,6 +849,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<AndesiteFunnelBlock> ANDESITE_FUNNEL =
|
public static final BlockEntry<AndesiteFunnelBlock> ANDESITE_FUNNEL =
|
||||||
REGISTRATE.block("andesite_funnel", AndesiteFunnelBlock::new)
|
REGISTRATE.block("andesite_funnel", AndesiteFunnelBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
|
.onRegister(addMovementBehaviour(FunnelMovementBehaviour.andesite()))
|
||||||
.transform(BuilderTransformers.funnel("andesite", Create.asResource("block/andesite_casing")))
|
.transform(BuilderTransformers.funnel("andesite", Create.asResource("block/andesite_casing")))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
@ -867,6 +870,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<BrassFunnelBlock> BRASS_FUNNEL =
|
public static final BlockEntry<BrassFunnelBlock> BRASS_FUNNEL =
|
||||||
REGISTRATE.block("brass_funnel", BrassFunnelBlock::new)
|
REGISTRATE.block("brass_funnel", BrassFunnelBlock::new)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SharedProperties::softMetal)
|
||||||
|
.onRegister(addMovementBehaviour(FunnelMovementBehaviour.brass()))
|
||||||
.transform(BuilderTransformers.funnel("brass", Create.asResource("block/brass_casing")))
|
.transform(BuilderTransformers.funnel("brass", Create.asResource("block/brass_casing")))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
@ -898,7 +902,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<RedstoneContactBlock> REDSTONE_CONTACT =
|
public static final BlockEntry<RedstoneContactBlock> REDSTONE_CONTACT =
|
||||||
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
|
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new ContactMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new ContactMovementBehaviour()))
|
||||||
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
|
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel("_", "block"))
|
.transform(customItemModel("_", "block"))
|
||||||
|
@ -965,7 +969,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<ExtractorBlock> EXTRACTOR = REGISTRATE.block("extractor", ExtractorBlock::new)
|
public static final BlockEntry<ExtractorBlock> EXTRACTOR = REGISTRATE.block("extractor", ExtractorBlock::new)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SharedProperties::softMetal)
|
||||||
.tag(AllBlockTags.BRITTLE.tag)
|
.tag(AllBlockTags.BRITTLE.tag)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new ExtractorMovementBehaviour()))
|
.onRegister(addMovementBehaviour(new ExtractorMovementBehaviour()))
|
||||||
.blockstate((c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, c.getName() + "/horizontal")))
|
.blockstate((c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, c.getName() + "/horizontal")))
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel("_", "horizontal"))
|
.transform(customItemModel("_", "horizontal"))
|
||||||
|
|
|
@ -10,11 +10,32 @@ import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
public class FunnelMovementBehaviour extends MovementBehaviour {
|
public class FunnelMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
|
private final boolean hasFilter;
|
||||||
|
|
||||||
|
public static FunnelMovementBehaviour andesite() {
|
||||||
|
return new FunnelMovementBehaviour(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FunnelMovementBehaviour brass() {
|
||||||
|
return new FunnelMovementBehaviour(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private FunnelMovementBehaviour(boolean hasFilter) {
|
||||||
|
this.hasFilter = hasFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||||
|
return new Vec3d(FunnelBlock.getFunnelFacing(context.state)
|
||||||
|
.getDirectionVec()).scale(.65);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||||
super.visitNewPosition(context, pos);
|
super.visitNewPosition(context, pos);
|
||||||
|
@ -42,7 +63,7 @@ public class FunnelMovementBehaviour extends MovementBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getFilter(MovementContext context) {
|
private ItemStack getFilter(MovementContext context) {
|
||||||
return ItemStack.read(context.tileData.getCompound("Filter"));
|
return hasFilter ? ItemStack.read(context.tileData.getCompound("Filter")) : ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue