mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:11:35 +01:00
Access transform go poof
This commit is contained in:
parent
bbac660048
commit
fc048d4e76
2 changed files with 18 additions and 5 deletions
|
@ -2,6 +2,8 @@ package com.simibubi.create.content.contraptions.components.actors.dispenser;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.DispenserBlock;
|
import net.minecraft.block.DispenserBlock;
|
||||||
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
|
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
|
||||||
|
@ -12,10 +14,12 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
private static final HashMap<Item, IMovedDispenseItemBehaviour> MOVED_DISPENSE_ITEM_BEHAVIOURS = new HashMap<>();
|
private static final HashMap<Item, IMovedDispenseItemBehaviour> MOVED_DISPENSE_ITEM_BEHAVIOURS = new HashMap<>();
|
||||||
|
private static final DispenserLookup BEHAVIOUR_LOOKUP = new DispenserLookup();
|
||||||
|
|
||||||
public static void gatherMovedDispenseItemBehaviours() {
|
public static void gatherMovedDispenseItemBehaviours() {
|
||||||
IMovedDispenseItemBehaviour.init();
|
IMovedDispenseItemBehaviour.init();
|
||||||
|
@ -47,7 +51,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
facingVec.normalize();
|
facingVec.normalize();
|
||||||
Direction clostestFacing = Direction.getFacingFromVector(facingVec.x, facingVec.y, facingVec.z);
|
Direction clostestFacing = Direction.getFacingFromVector(facingVec.x, facingVec.y, facingVec.z);
|
||||||
ContraptionBlockSource blockSource = new ContraptionBlockSource(context, pos, clostestFacing);
|
ContraptionBlockSource blockSource = new ContraptionBlockSource(context, pos, clostestFacing);
|
||||||
IDispenseItemBehavior idispenseitembehavior = ((DispenserBlock) Blocks.DISPENSER).getBehavior(itemstack);
|
IDispenseItemBehavior idispenseitembehavior = BEHAVIOUR_LOOKUP.getBehavior(itemstack);
|
||||||
if (idispenseitembehavior.getClass() != DefaultDispenseItemBehavior.class) { // There is a dispense item behaviour registered for the vanilla dispenser
|
if (idispenseitembehavior.getClass() != DefaultDispenseItemBehavior.class) { // There is a dispense item behaviour registered for the vanilla dispenser
|
||||||
idispenseitembehavior.dispense(blockSource, itemstack);
|
idispenseitembehavior.dispense(blockSource, itemstack);
|
||||||
return;
|
return;
|
||||||
|
@ -59,4 +63,16 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
defaultBehaviour.dispense(itemstack, context, pos); // the default: launch the item
|
defaultBehaviour.dispense(itemstack, context, pos); // the default: launch the item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
private static class DispenserLookup extends DispenserBlock {
|
||||||
|
protected DispenserLookup() {
|
||||||
|
super(Block.Properties.from(Blocks.DISPENSER));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDispenseItemBehavior getBehavior(ItemStack itemStack) {
|
||||||
|
return super.getBehavior(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
public net.minecraft.network.play.ServerPlayNetHandler field_147365_f # floatingTickCount
|
public net.minecraft.network.play.ServerPlayNetHandler field_147365_f # floatingTickCount
|
||||||
|
|
||||||
# CubeParticle
|
# CubeParticle
|
||||||
protected net.minecraft.client.particle.Particle field_228343_B_ # collidedY
|
protected net.minecraft.client.particle.Particle field_228343_B_ # collidedY
|
||||||
|
|
||||||
# Dispenser movement behaviour default
|
|
||||||
public net.minecraft.block.DispenserBlock func_149940_a(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/dispenser/IDispenseItemBehavior; # getBehavior
|
|
Loading…
Reference in a new issue