diff --git a/src/main/java/com/simibubi/create/config/CKinetics.java b/src/main/java/com/simibubi/create/config/CKinetics.java index bdb8c6e1e..47383e45b 100644 --- a/src/main/java/com/simibubi/create/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/config/CKinetics.java @@ -6,6 +6,8 @@ public class CKinetics extends ConfigBase { public ConfigInt crushingDamage = i(4, 0, "crushingDamage", Comments.crushingDamage); public ConfigInt maxMotorSpeed = i(256, 64, "maxMotorSpeed", Comments.rpm, Comments.maxMotorSpeed); public ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed); + public ConfigEnum ignoreDeployerAttacks = + e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks); public ConfigGroup fan = group(0, "encasedFan", "Encased Fan"); public ConfigInt fanPushDistance = i(20, 5, "fanPushDistance", Comments.fanPushDistance); @@ -24,7 +26,8 @@ public class CKinetics extends ConfigBase { public ConfigGroup state = group(0, "stats", Comments.stats); public ConfigFloat mediumSpeed = f(30, 0, 4096, "mediumSpeed", Comments.rpm, Comments.mediumSpeed); public ConfigFloat fastSpeed = f(100, 0, 65535, "fastSpeed", Comments.rpm, Comments.fastSpeed); - public ConfigFloat mediumStressImpact = f(8, 0, 4096, "mediumStressImpact", Comments.su, Comments.mediumStressImpact); + public ConfigFloat mediumStressImpact = + f(8, 0, 4096, "mediumStressImpact", Comments.su, Comments.mediumStressImpact); public ConfigFloat highStressImpact = f(32, 0, 65535, "highStressImpact", Comments.su, Comments.highStressImpact); public ConfigFloat mediumCapacity = f(128, 0, 4096, "mediumCapacity", Comments.su, Comments.mediumCapacity); public ConfigFloat highCapacity = f(512, 0, 65535, "highCapacity", Comments.su, Comments.highCapacity); @@ -61,6 +64,11 @@ public class CKinetics extends ConfigBase { static String mediumCapacity = "Minimum added Capacity by sources to be considered 'medium'"; static String highCapacity = "Minimum added Capacity by sources to be considered 'high'"; static String stress = "Fine tune the kinetic stats of individual components"; + static String ignoreDeployerAttacks = "Select what mobs should ignore Deployers when attacked by them."; + } + + public static enum DeployerAggroSetting { + ALL, CREEPERS, NONE } } diff --git a/src/main/java/com/simibubi/create/config/ConfigBase.java b/src/main/java/com/simibubi/create/config/ConfigBase.java index 8af7f4ac6..98fe50800 100644 --- a/src/main/java/com/simibubi/create/config/ConfigBase.java +++ b/src/main/java/com/simibubi/create/config/ConfigBase.java @@ -10,6 +10,7 @@ import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.Builder; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; +import net.minecraftforge.common.ForgeConfigSpec.EnumValue; import net.minecraftforge.common.ForgeConfigSpec.IntValue; public abstract class ConfigBase { @@ -61,6 +62,10 @@ public abstract class ConfigBase { protected ConfigInt i(int current, int min, String name, String... comment) { return i(current, min, Integer.MAX_VALUE, name, comment); } + + protected > ConfigEnum e(T defaultValue, String name, String... comment) { + return new ConfigEnum<>(name, defaultValue, comment); + } protected ConfigGroup group(int depth, String name, String... comment) { return new ConfigGroup(name, depth, comment); @@ -153,6 +158,14 @@ public abstract class ConfigBase { super(name, builder -> builder.define(name, def), comment); } } + + public class ConfigEnum> extends CValue> { + + public ConfigEnum(String name, T defaultValue, String[] comment) { + super(name, builder -> builder.defineEnum(name, defaultValue), comment); + } + + } public class ConfigFloat extends CValue { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java index cefd52f8d..545687ac6 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java @@ -6,12 +6,17 @@ import java.util.UUID; import org.apache.commons.lang3.tuple.Pair; import com.mojang.authlib.GameProfile; +import com.simibubi.create.config.AllConfigs; +import com.simibubi.create.config.CKinetics; import com.simibubi.create.foundation.utility.Lang; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.MobEntity; import net.minecraft.entity.Pose; +import net.minecraft.entity.monster.CreeperEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; @@ -32,6 +37,7 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; +import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -107,6 +113,30 @@ public class DeployerFakePlayer extends FakePlayer { event.setCanceled(true); } + @SubscribeEvent + public static void entitiesDontRetaliate(LivingSetAttackTargetEvent event) { + if (!(event.getTarget() instanceof DeployerFakePlayer)) + return; + LivingEntity entityLiving = event.getEntityLiving(); + if (!(entityLiving instanceof MobEntity)) + return; + MobEntity mob = (MobEntity) entityLiving; + + CKinetics.DeployerAggroSetting setting = AllConfigs.SERVER.kinetics.ignoreDeployerAttacks.get(); + + switch (setting) { + case ALL: + mob.setAttackTarget(null); + break; + case CREEPERS: + if (mob instanceof CreeperEntity) + mob.setAttackTarget(null); + break; + case NONE: + default: + } + } + private static class FakePlayNetHandler extends ServerPlayNetHandler { public FakePlayNetHandler(MinecraftServer server, ServerPlayerEntity playerIn) { super(server, NETWORK_MANAGER, playerIn); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerMovementBehaviour.java index f46165b24..67ca519b1 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -91,8 +91,12 @@ public class DeployerMovementBehaviour extends MovementBehaviour { if (context.world.isRemote) return; tryDisposeOfEverything(context); + DeployerFakePlayer player = getPlayer(context); + if (player == null) + return; + player.remove(); } - + private void tryGrabbingItem(MovementContext context) { DeployerFakePlayer player = getPlayer(context); if (player == null) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java index 63f200861..bc397d1df 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java @@ -13,6 +13,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.TessellatorHelper; @@ -62,22 +63,37 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer, IBeltAttachment { + implements IWithTileEntity, IBeltAttachment, IWrenchable { - public static BooleanProperty POWERED = BlockStateProperties.POWERED; - public static BooleanProperty BELT = BooleanProperty.create("belt"); + public static final BooleanProperty POWERED = BlockStateProperties.POWERED; + public static final BooleanProperty BELT = BooleanProperty.create("belt"); + public static final EnumProperty MODE = EnumProperty.create("mode", Mode.class); public BeltObserverBlock() { super(Properties.from(Blocks.ANDESITE)); @@ -64,7 +77,7 @@ public class BeltObserverBlock extends HorizontalBlock @Override protected void fillStateContainer(Builder builder) { - builder.add(POWERED, HORIZONTAL_FACING, BELT); + builder.add(POWERED, HORIZONTAL_FACING, BELT, MODE); super.fillStateContainer(builder); } @@ -167,52 +180,93 @@ public class BeltObserverBlock extends HorizontalBlock @Override public boolean startProcessingItem(BeltTileEntity te, TransportedItemStack transported, BeltAttachmentState state) { - state.processingDuration = 0; - FilteringBehaviour behaviour = TileEntityBehaviour.get(te.getWorld(), state.attachmentPos, - FilteringBehaviour.TYPE); - if (behaviour != null) { - if (!behaviour.test(transported.stack)) { - state.processingDuration = -1; - return false; + World world = te.getWorld(); + BlockState blockState = world.getBlockState(state.attachmentPos); + if (blockState.get(MODE) == Mode.DETECT) + return false; + + FilteringBehaviour behaviour = + TileEntityBehaviour.get(te.getWorld(), state.attachmentPos, FilteringBehaviour.TYPE); + if (behaviour != null && !behaviour.test(transported.stack)) + return false; + + world.setBlockState(state.attachmentPos, blockState.with(POWERED, true)); + world.notifyNeighborsOfStateChange(state.attachmentPos, this); + withTileEntityDo(world, state.attachmentPos, BeltObserverTileEntity::resetTurnOffCooldown); + + Mode mode = blockState.get(MODE); + if (mode == Mode.EJECT || mode == Mode.SPLIT) { + ItemStack copy = transported.stack.copy(); + ItemStack toEject = mode == Mode.EJECT ? transported.stack : copy.split(transported.stack.getCount() / 2); + + if (!toEject.isEmpty()) { + if (!eject(world, toEject, state.attachmentPos, blockState.get(HORIZONTAL_FACING))) + return true; + transported.stack = mode == Mode.EJECT ? ItemStack.EMPTY : copy; } } + return false; + } + + @Override + public boolean processItem(BeltTileEntity te, TransportedItemStack transported, BeltAttachmentState state) { World world = te.getWorld(); BlockState blockState = world.getBlockState(state.attachmentPos); - if (state.processingDuration == 0) { - world.setBlockState(state.attachmentPos, blockState.with(POWERED, true)); - world.getPendingBlockTicks().scheduleTick(state.attachmentPos, this, 6); - world.notifyNeighborsOfStateChange(state.attachmentPos, this); - return true; + withTileEntityDo(world, state.attachmentPos, BeltObserverTileEntity::resetTurnOffCooldown); + + Mode mode = blockState.get(MODE); + if (mode == Mode.EJECT || mode == Mode.SPLIT) { + ItemStack copy = transported.stack.copy(); + ItemStack toEject = mode == Mode.EJECT ? transported.stack : copy.split(transported.stack.getCount() / 2); + + if (!eject(world, toEject, state.attachmentPos, blockState.get(HORIZONTAL_FACING))) + return true; + transported.stack = mode == Mode.EJECT ? ItemStack.EMPTY : copy; } + return false; } + private boolean eject(World world, ItemStack stack, BlockPos observerPos, Direction facing) { + BlockPos potentialBeltPos = observerPos.offset(facing, 2); + TileEntity tileEntity = world.getTileEntity(potentialBeltPos); + if (tileEntity instanceof BeltTileEntity) { + BeltTileEntity belt = (BeltTileEntity) tileEntity; + return belt.tryInsertingFromSide(facing, stack, false); + } + + boolean empty = world.getBlockState(potentialBeltPos).getCollisionShape(world, potentialBeltPos).isEmpty(); + float yOffset = empty ? 0 : .5f; + AxisAlignedBB bb = new AxisAlignedBB(empty ? potentialBeltPos : potentialBeltPos.up()); + if (!world.getEntitiesWithinAABBExcludingEntity(null, bb).isEmpty()) + return false; + + Vec3d motion = new Vec3d(facing.getDirectionVec()).scale(1 / 16f); + Vec3d entityPos = VecHelper.getCenterOf(potentialBeltPos).add(0, yOffset + .25f, 0).subtract(motion); + ItemEntity entity = new ItemEntity(world, entityPos.x, entityPos.y, entityPos.z, stack); + entity.setMotion(motion); + entity.setPickupDelay(5); + world.playSound(null, observerPos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .125f, .1f); + world.addEntity(entity); + return true; + } + @Override public boolean processEntity(BeltTileEntity te, Entity entity, BeltAttachmentState state) { if (te.getWorld().isRemote) return false; - - if (state.processingEntity != entity) { - state.processingEntity = entity; - state.processingDuration = 0; - } - if (entity.getPositionVec().distanceTo(VecHelper.getCenterOf(te.getPos())) > .5f) return false; - if (state.processingDuration == -1) { - return false; - } World world = te.getWorld(); BlockState blockState = world.getBlockState(state.attachmentPos); if (blockState.get(POWERED)) return false; - state.processingDuration = -1; world.setBlockState(state.attachmentPos, blockState.with(POWERED, true)); - world.getPendingBlockTicks().scheduleTick(state.attachmentPos, this, 6); world.notifyNeighborsOfStateChange(state.attachmentPos, this); + withTileEntityDo(te.getWorld(), state.attachmentPos, BeltObserverTileEntity::resetTurnOffCooldown); return false; } @@ -222,4 +276,23 @@ public class BeltObserverBlock extends HorizontalBlock worldIn.notifyNeighborsOfStateChange(pos, this); } + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + if (!world.isRemote) { + world.setBlockState(context.getPos(), state.with(POWERED, false).cycle(MODE), 3); + world.notifyNeighborsOfStateChange(context.getPos(), this); + } + return ActionResultType.SUCCESS; + } + + public enum Mode implements IStringSerializable { + DETECT, PULSE, EJECT, SPLIT; + + @Override + public String getName() { + return Lang.asId(name()); + } + } + } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntity.java index fcff01bc4..7aa8351f0 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntity.java @@ -9,8 +9,12 @@ import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour.SlotPositioning; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.VecHelper; +import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity; +import com.simibubi.create.modules.logistics.block.belts.BeltObserverBlock.Mode; import net.minecraft.block.HorizontalBlock; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.Vec3d; @@ -18,9 +22,65 @@ public class BeltObserverTileEntity extends SmartTileEntity { private static FilteringBehaviour.SlotPositioning slots; private FilteringBehaviour filtering; + public int turnOffTicks = 0; public BeltObserverTileEntity() { super(AllTileEntities.ENTITY_DETECTOR.type); + setLazyTickRate(20); + } + + @Override + public void tick() { + super.tick(); + if (turnOffTicks > 0) { + turnOffTicks--; + if (turnOffTicks == 0) + world.getPendingBlockTicks().scheduleTick(pos, getBlockState().getBlock(), 1); + } + + if (!isActive()) + return; + if (getBlockState().get(BeltObserverBlock.MODE) != Mode.DETECT) + return; + + TileEntity tileEntity = + world.getTileEntity(pos.offset(getBlockState().get(BeltObserverBlock.HORIZONTAL_FACING))); + if (!(tileEntity instanceof BeltTileEntity)) + return; + BeltTileEntity belt = (BeltTileEntity) tileEntity; + BeltTileEntity controllerTE = belt.getControllerTE(); + if (controllerTE == null) + return; + + controllerTE.getInventory().forEachWithin(belt.index + .5f, .45f, stack -> { + if (filtering.test(stack.stack) && turnOffTicks != 6) { + world.setBlockState(pos, getBlockState().with(BeltObserverBlock.POWERED, true)); + world.notifyNeighborsOfStateChange(pos, getBlockState().getBlock()); + resetTurnOffCooldown(); + } + return null; + }); + + } + + private boolean isActive() { + return getBlockState().get(BeltObserverBlock.BELT); + } + + public void resetTurnOffCooldown() { + turnOffTicks = 6; + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.putInt("TurnOff", turnOffTicks); + return super.write(compound); + } + + @Override + public void read(CompoundNBT compound) { + turnOffTicks = compound.getInt("TurnOff"); + super.read(compound); } @Override diff --git a/src/main/resources/assets/create/blockstates/entity_detector.json b/src/main/resources/assets/create/blockstates/entity_detector.json index f6a252d3b..50543c629 100644 --- a/src/main/resources/assets/create/blockstates/entity_detector.json +++ b/src/main/resources/assets/create/blockstates/entity_detector.json @@ -1,23 +1,86 @@ { "variants": { - "powered=false,belt=false,facing=south": { "model": "create:block/entity_detector", "y": 0 }, - "powered=false,belt=false,facing=east": { "model": "create:block/entity_detector", "y": 270 }, - "powered=false,belt=false,facing=north": { "model": "create:block/entity_detector", "y": 180 }, - "powered=false,belt=false,facing=west": { "model": "create:block/entity_detector", "y": 90 }, + "mode=detect,powered=false,belt=false,facing=south": { "model": "create:block/belt_observer/detect", "y": 0 }, + "mode=detect,powered=false,belt=false,facing=east": { "model": "create:block/belt_observer/detect", "y": 270 }, + "mode=detect,powered=false,belt=false,facing=north": { "model": "create:block/belt_observer/detect", "y": 180 }, + "mode=detect,powered=false,belt=false,facing=west": { "model": "create:block/belt_observer/detect", "y": 90 }, - "powered=true,belt=false,facing=south": { "model": "create:block/entity_detector_powered", "y": 0 }, - "powered=true,belt=false,facing=east": { "model": "create:block/entity_detector_powered", "y": 270 }, - "powered=true,belt=false,facing=north": { "model": "create:block/entity_detector_powered", "y": 180 }, - "powered=true,belt=false,facing=west": { "model": "create:block/entity_detector_powered", "y": 90 }, + "mode=detect,powered=true,belt=false,facing=south": { "model": "create:block/belt_observer/detect_powered", "y": 0 }, + "mode=detect,powered=true,belt=false,facing=east": { "model": "create:block/belt_observer/detect_powered", "y": 270 }, + "mode=detect,powered=true,belt=false,facing=north": { "model": "create:block/belt_observer/detect_powered", "y": 180 }, + "mode=detect,powered=true,belt=false,facing=west": { "model": "create:block/belt_observer/detect_powered", "y": 90 }, - "powered=false,belt=true,facing=south": { "model": "create:block/entity_detector_with_belt", "y": 0 }, - "powered=false,belt=true,facing=east": { "model": "create:block/entity_detector_with_belt", "y": 270 }, - "powered=false,belt=true,facing=north": { "model": "create:block/entity_detector_with_belt", "y": 180 }, - "powered=false,belt=true,facing=west": { "model": "create:block/entity_detector_with_belt", "y": 90 }, + "mode=detect,powered=false,belt=true,facing=south": { "model": "create:block/belt_observer/detect_belt", "y": 0 }, + "mode=detect,powered=false,belt=true,facing=east": { "model": "create:block/belt_observer/detect_belt", "y": 270 }, + "mode=detect,powered=false,belt=true,facing=north": { "model": "create:block/belt_observer/detect_belt", "y": 180 }, + "mode=detect,powered=false,belt=true,facing=west": { "model": "create:block/belt_observer/detect_belt", "y": 90 }, - "powered=true,belt=true,facing=south": { "model": "create:block/entity_detector_with_belt_powered", "y": 0 }, - "powered=true,belt=true,facing=east": { "model": "create:block/entity_detector_with_belt_powered", "y": 270 }, - "powered=true,belt=true,facing=north": { "model": "create:block/entity_detector_with_belt_powered", "y": 180 }, - "powered=true,belt=true,facing=west": { "model": "create:block/entity_detector_with_belt_powered", "y": 90 } + "mode=detect,powered=true,belt=true,facing=south": { "model": "create:block/belt_observer/detect_belt_powered", "y": 0 }, + "mode=detect,powered=true,belt=true,facing=east": { "model": "create:block/belt_observer/detect_belt_powered", "y": 270 }, + "mode=detect,powered=true,belt=true,facing=north": { "model": "create:block/belt_observer/detect_belt_powered", "y": 180 }, + "mode=detect,powered=true,belt=true,facing=west": { "model": "create:block/belt_observer/detect_belt_powered", "y": 90 }, + + + "mode=pulse,powered=false,belt=false,facing=south": { "model": "create:block/belt_observer/pulse", "y": 0 }, + "mode=pulse,powered=false,belt=false,facing=east": { "model": "create:block/belt_observer/pulse", "y": 270 }, + "mode=pulse,powered=false,belt=false,facing=north": { "model": "create:block/belt_observer/pulse", "y": 180 }, + "mode=pulse,powered=false,belt=false,facing=west": { "model": "create:block/belt_observer/pulse", "y": 90 }, + + "mode=pulse,powered=true,belt=false,facing=south": { "model": "create:block/belt_observer/pulse_powered", "y": 0 }, + "mode=pulse,powered=true,belt=false,facing=east": { "model": "create:block/belt_observer/pulse_powered", "y": 270 }, + "mode=pulse,powered=true,belt=false,facing=north": { "model": "create:block/belt_observer/pulse_powered", "y": 180 }, + "mode=pulse,powered=true,belt=false,facing=west": { "model": "create:block/belt_observer/pulse_powered", "y": 90 }, + + "mode=pulse,powered=false,belt=true,facing=south": { "model": "create:block/belt_observer/pulse_belt", "y": 0 }, + "mode=pulse,powered=false,belt=true,facing=east": { "model": "create:block/belt_observer/pulse_belt", "y": 270 }, + "mode=pulse,powered=false,belt=true,facing=north": { "model": "create:block/belt_observer/pulse_belt", "y": 180 }, + "mode=pulse,powered=false,belt=true,facing=west": { "model": "create:block/belt_observer/pulse_belt", "y": 90 }, + + "mode=pulse,powered=true,belt=true,facing=south": { "model": "create:block/belt_observer/pulse_belt_powered", "y": 0 }, + "mode=pulse,powered=true,belt=true,facing=east": { "model": "create:block/belt_observer/pulse_belt_powered", "y": 270 }, + "mode=pulse,powered=true,belt=true,facing=north": { "model": "create:block/belt_observer/pulse_belt_powered", "y": 180 }, + "mode=pulse,powered=true,belt=true,facing=west": { "model": "create:block/belt_observer/pulse_belt_powered", "y": 90 }, + + + "mode=eject,powered=false,belt=false,facing=south": { "model": "create:block/belt_observer/eject", "y": 0 }, + "mode=eject,powered=false,belt=false,facing=east": { "model": "create:block/belt_observer/eject", "y": 270 }, + "mode=eject,powered=false,belt=false,facing=north": { "model": "create:block/belt_observer/eject", "y": 180 }, + "mode=eject,powered=false,belt=false,facing=west": { "model": "create:block/belt_observer/eject", "y": 90 }, + + "mode=eject,powered=true,belt=false,facing=south": { "model": "create:block/belt_observer/eject_powered", "y": 0 }, + "mode=eject,powered=true,belt=false,facing=east": { "model": "create:block/belt_observer/eject_powered", "y": 270 }, + "mode=eject,powered=true,belt=false,facing=north": { "model": "create:block/belt_observer/eject_powered", "y": 180 }, + "mode=eject,powered=true,belt=false,facing=west": { "model": "create:block/belt_observer/eject_powered", "y": 90 }, + + "mode=eject,powered=false,belt=true,facing=south": { "model": "create:block/belt_observer/eject_belt", "y": 0 }, + "mode=eject,powered=false,belt=true,facing=east": { "model": "create:block/belt_observer/eject_belt", "y": 270 }, + "mode=eject,powered=false,belt=true,facing=north": { "model": "create:block/belt_observer/eject_belt", "y": 180 }, + "mode=eject,powered=false,belt=true,facing=west": { "model": "create:block/belt_observer/eject_belt", "y": 90 }, + + "mode=eject,powered=true,belt=true,facing=south": { "model": "create:block/belt_observer/eject_belt_powered", "y": 0 }, + "mode=eject,powered=true,belt=true,facing=east": { "model": "create:block/belt_observer/eject_belt_powered", "y": 270 }, + "mode=eject,powered=true,belt=true,facing=north": { "model": "create:block/belt_observer/eject_belt_powered", "y": 180 }, + "mode=eject,powered=true,belt=true,facing=west": { "model": "create:block/belt_observer/eject_belt_powered", "y": 90 }, + + + "mode=split,powered=false,belt=false,facing=south": { "model": "create:block/belt_observer/split", "y": 0 }, + "mode=split,powered=false,belt=false,facing=east": { "model": "create:block/belt_observer/split", "y": 270 }, + "mode=split,powered=false,belt=false,facing=north": { "model": "create:block/belt_observer/split", "y": 180 }, + "mode=split,powered=false,belt=false,facing=west": { "model": "create:block/belt_observer/split", "y": 90 }, + + "mode=split,powered=true,belt=false,facing=south": { "model": "create:block/belt_observer/split_powered", "y": 0 }, + "mode=split,powered=true,belt=false,facing=east": { "model": "create:block/belt_observer/split_powered", "y": 270 }, + "mode=split,powered=true,belt=false,facing=north": { "model": "create:block/belt_observer/split_powered", "y": 180 }, + "mode=split,powered=true,belt=false,facing=west": { "model": "create:block/belt_observer/split_powered", "y": 90 }, + + "mode=split,powered=false,belt=true,facing=south": { "model": "create:block/belt_observer/split_belt", "y": 0 }, + "mode=split,powered=false,belt=true,facing=east": { "model": "create:block/belt_observer/split_belt", "y": 270 }, + "mode=split,powered=false,belt=true,facing=north": { "model": "create:block/belt_observer/split_belt", "y": 180 }, + "mode=split,powered=false,belt=true,facing=west": { "model": "create:block/belt_observer/split_belt", "y": 90 }, + + "mode=split,powered=true,belt=true,facing=south": { "model": "create:block/belt_observer/split_belt_powered", "y": 0 }, + "mode=split,powered=true,belt=true,facing=east": { "model": "create:block/belt_observer/split_belt_powered", "y": 270 }, + "mode=split,powered=true,belt=true,facing=north": { "model": "create:block/belt_observer/split_belt_powered", "y": 180 }, + "mode=split,powered=true,belt=true,facing=west": { "model": "create:block/belt_observer/split_belt_powered", "y": 90 } } } \ No newline at end of file diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 4754ecdb3..746143f91 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -953,11 +953,15 @@ "block.create.brass_casing.tooltip.behaviour1": "_Reinforces_ _belts_ with a brass foundation. Reinforced Belts can support _Belt_ _Tunnels_ aswell as _Extractors,_ _Funnels_ and _Transposers_ interacting with the belt from the sides and below.", "block.create.entity_detector.tooltip": "BELT OBSERVER", - "block.create.entity_detector.tooltip.summary": "Detects items passing by on a _Mechanical_ _Belt_ in front of it. Works well with a _Piston_ on top, pushing certain items off.", - "block.create.entity_detector.tooltip.condition1": "When item matches Filter", - "block.create.entity_detector.tooltip.behaviour1": "Provides a short _Redstone_ _pulse_ to all sides. An Empty Filter matches all passing items.", - "block.create.entity_detector.tooltip.control1": "R-Click on Filter Space", - "block.create.entity_detector.tooltip.action1": "Assigns currently _held_ _stack_ as the _Filter._ Observer will react to this item type only.", + "block.create.entity_detector.tooltip.summary": "Detects items and entities passing by on a _Mechanical_ _Belt_ in front of it. Use a _Wrench_ to cycle its behaviour. Non-items will always be handled in detect mode regarless of the setting.", + "block.create.entity_detector.tooltip.condition1": "Detect Mode", + "block.create.entity_detector.tooltip.behaviour1": "Provides redstone _while_ a _matching_ _item_ _is_ in the observed belt segment.", + "block.create.entity_detector.tooltip.condition2": "Pulse Mode", + "block.create.entity_detector.tooltip.behaviour2": "Emits a _pulse_ when a _matching_ _item_ _passes_ the center of the observed belt segment.", + "block.create.entity_detector.tooltip.condition3": "Eject Mode", + "block.create.entity_detector.tooltip.behaviour3": "_Ejects_ _matching_ _items_ off the side. If the target belt or space is _occupied,_ the item will be _held_ _in_ _place._", + "block.create.entity_detector.tooltip.condition4": "Split Mode", + "block.create.entity_detector.tooltip.behaviour4": "_Splits_ a _matching_ _item_ _stack_ and _ejects_ _half_ of it off the side.", "block.create.pulse_repeater.tooltip": "PULSE REPEATER", "block.create.pulse_repeater.tooltip.summary": "A simple circuit for cutting passing redstone signals to a length of _1_ _tick._", diff --git a/src/main/resources/assets/create/models/block/entity_detector.json b/src/main/resources/assets/create/models/block/belt_observer/base.json similarity index 96% rename from src/main/resources/assets/create/models/block/entity_detector.json rename to src/main/resources/assets/create/models/block/belt_observer/base.json index 707f404f5..32c14f1ba 100644 --- a/src/main/resources/assets/create/models/block/entity_detector.json +++ b/src/main/resources/assets/create/models/block/belt_observer/base.json @@ -4,9 +4,9 @@ "textures": { "brass_casing": "create:block/brass_casing", "extractor": "create:block/extractor", - "particle": "create:block/entity_detector_off", - "entity_detector_off": "create:block/entity_detector_off", - "entity_detector_front": "create:block/entity_detector_front" + "particle": "#texture", + "entity_detector_off": "#texture", + "entity_detector_front": "create:block/belt_observer_front" }, "elements": [ { diff --git a/src/main/resources/assets/create/models/block/entity_detector_with_belt.json b/src/main/resources/assets/create/models/block/belt_observer/base_belt.json similarity index 96% rename from src/main/resources/assets/create/models/block/entity_detector_with_belt.json rename to src/main/resources/assets/create/models/block/belt_observer/base_belt.json index 1e1e00118..baed95503 100644 --- a/src/main/resources/assets/create/models/block/entity_detector_with_belt.json +++ b/src/main/resources/assets/create/models/block/belt_observer/base_belt.json @@ -4,9 +4,9 @@ "textures": { "3": "create:block/extractor", "brass_casing": "create:block/brass_casing", - "particle": "create:block/entity_detector_off", - "entity_detector_off": "create:block/entity_detector_off", - "entity_detector_front": "create:block/entity_detector_front" + "particle": "#texture", + "entity_detector_off": "#texture", + "entity_detector_front": "create:block/belt_observer_front" }, "elements": [ { diff --git a/src/main/resources/assets/create/models/block/belt_observer/base_belt_powered.json b/src/main/resources/assets/create/models/block/belt_observer/base_belt_powered.json new file mode 100644 index 000000000..a81d7492c --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/base_belt_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt", + "textures": { + "3": "create:block/extractor_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/base_powered.json b/src/main/resources/assets/create/models/block/belt_observer/base_powered.json new file mode 100644 index 000000000..17177a585 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/base_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base", + "textures": { + "extractor": "create:block/extractor_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/detect.json b/src/main/resources/assets/create/models/block/belt_observer/detect.json new file mode 100644 index 000000000..5a6ba1150 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/detect.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base", + "textures": { + "texture": "create:block/belt_observer_detect" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/detect_belt.json b/src/main/resources/assets/create/models/block/belt_observer/detect_belt.json new file mode 100644 index 000000000..90dcf7aed --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/detect_belt.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt", + "textures": { + "texture": "create:block/belt_observer_detect" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/detect_belt_powered.json b/src/main/resources/assets/create/models/block/belt_observer/detect_belt_powered.json new file mode 100644 index 000000000..d941db520 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/detect_belt_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt_powered", + "textures": { + "texture": "create:block/belt_observer_detect_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/detect_powered.json b/src/main/resources/assets/create/models/block/belt_observer/detect_powered.json new file mode 100644 index 000000000..a2a3a4bb9 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/detect_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_powered", + "textures": { + "texture": "create:block/belt_observer_detect_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/eject.json b/src/main/resources/assets/create/models/block/belt_observer/eject.json new file mode 100644 index 000000000..821e2c378 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/eject.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base", + "textures": { + "texture": "create:block/belt_observer_eject" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/eject_belt.json b/src/main/resources/assets/create/models/block/belt_observer/eject_belt.json new file mode 100644 index 000000000..4f590d91a --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/eject_belt.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt", + "textures": { + "texture": "create:block/belt_observer_eject" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/eject_belt_powered.json b/src/main/resources/assets/create/models/block/belt_observer/eject_belt_powered.json new file mode 100644 index 000000000..d4656f309 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/eject_belt_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt_powered", + "textures": { + "texture": "create:block/belt_observer_eject_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/eject_powered.json b/src/main/resources/assets/create/models/block/belt_observer/eject_powered.json new file mode 100644 index 000000000..c7fd5ec96 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/eject_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_powered", + "textures": { + "texture": "create:block/belt_observer_eject_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/pulse.json b/src/main/resources/assets/create/models/block/belt_observer/pulse.json new file mode 100644 index 000000000..39d8c5ef3 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/pulse.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base", + "textures": { + "texture": "create:block/belt_observer_pulse" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/pulse_belt.json b/src/main/resources/assets/create/models/block/belt_observer/pulse_belt.json new file mode 100644 index 000000000..b93de0c5b --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/pulse_belt.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt", + "textures": { + "texture": "create:block/belt_observer_pulse" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/pulse_belt_powered.json b/src/main/resources/assets/create/models/block/belt_observer/pulse_belt_powered.json new file mode 100644 index 000000000..7d7bb923f --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/pulse_belt_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt_powered", + "textures": { + "texture": "create:block/belt_observer_pulse_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/pulse_powered.json b/src/main/resources/assets/create/models/block/belt_observer/pulse_powered.json new file mode 100644 index 000000000..93c6da0a7 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/pulse_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_powered", + "textures": { + "texture": "create:block/belt_observer_pulse_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/split.json b/src/main/resources/assets/create/models/block/belt_observer/split.json new file mode 100644 index 000000000..12405d396 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/split.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base", + "textures": { + "texture": "create:block/belt_observer_split" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/split_belt.json b/src/main/resources/assets/create/models/block/belt_observer/split_belt.json new file mode 100644 index 000000000..bc413b344 --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/split_belt.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt", + "textures": { + "texture": "create:block/belt_observer_split" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/split_belt_powered.json b/src/main/resources/assets/create/models/block/belt_observer/split_belt_powered.json new file mode 100644 index 000000000..2fad9a1bb --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/split_belt_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_belt_powered", + "textures": { + "texture": "create:block/belt_observer_split_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/belt_observer/split_powered.json b/src/main/resources/assets/create/models/block/belt_observer/split_powered.json new file mode 100644 index 000000000..5d373467f --- /dev/null +++ b/src/main/resources/assets/create/models/block/belt_observer/split_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/belt_observer/base_powered", + "textures": { + "texture": "create:block/belt_observer_split_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/entity_detector_powered.json b/src/main/resources/assets/create/models/block/entity_detector_powered.json deleted file mode 100644 index 51b3e02a6..000000000 --- a/src/main/resources/assets/create/models/block/entity_detector_powered.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "create:block/entity_detector", - "textures": { - "extractor": "create:block/extractor_powered", - "entity_detector_off": "create:block/entity_detector_on", - "particle": "create:block/entity_detector_on" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/entity_detector_with_belt_powered.json b/src/main/resources/assets/create/models/block/entity_detector_with_belt_powered.json deleted file mode 100644 index 9c93843fa..000000000 --- a/src/main/resources/assets/create/models/block/entity_detector_with_belt_powered.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "create:block/entity_detector_with_belt", - "textures": { - "3": "create:block/extractor_powered", - "entity_detector_off": "create:block/entity_detector_on", - "particle": "create:block/entity_detector_on" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/entity_detector.json b/src/main/resources/assets/create/models/item/entity_detector.json index dba31f41f..c00967dc9 100644 --- a/src/main/resources/assets/create/models/item/entity_detector.json +++ b/src/main/resources/assets/create/models/item/entity_detector.json @@ -15,8 +15,8 @@ }, "textures": { "brass_casing": "create:block/brass_casing", - "entity_detector_off": "create:block/entity_detector_off", - "entity_detector_front": "create:block/entity_detector_front" + "entity_detector_off": "create:block/belt_observer_detect", + "entity_detector_front": "create:block/belt_observer_front" }, "elements": [ { diff --git a/src/main/resources/assets/create/textures/block/belt_observer_detect.png b/src/main/resources/assets/create/textures/block/belt_observer_detect.png new file mode 100644 index 000000000..52b6b9180 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_detect.png differ diff --git a/src/main/resources/assets/create/textures/block/belt_observer_detect_powered.png b/src/main/resources/assets/create/textures/block/belt_observer_detect_powered.png new file mode 100644 index 000000000..af9a00ace Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_detect_powered.png differ diff --git a/src/main/resources/assets/create/textures/block/belt_observer_eject.png b/src/main/resources/assets/create/textures/block/belt_observer_eject.png new file mode 100644 index 000000000..bfc4beaef Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_eject.png differ diff --git a/src/main/resources/assets/create/textures/block/belt_observer_eject_powered.png b/src/main/resources/assets/create/textures/block/belt_observer_eject_powered.png new file mode 100644 index 000000000..b315be0f8 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_eject_powered.png differ diff --git a/src/main/resources/assets/create/textures/block/entity_detector_front.png b/src/main/resources/assets/create/textures/block/belt_observer_front.png similarity index 100% rename from src/main/resources/assets/create/textures/block/entity_detector_front.png rename to src/main/resources/assets/create/textures/block/belt_observer_front.png diff --git a/src/main/resources/assets/create/textures/block/belt_observer_pulse.png b/src/main/resources/assets/create/textures/block/belt_observer_pulse.png new file mode 100644 index 000000000..ff8622be3 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_pulse.png differ diff --git a/src/main/resources/assets/create/textures/block/belt_observer_pulse_powered.png b/src/main/resources/assets/create/textures/block/belt_observer_pulse_powered.png new file mode 100644 index 000000000..e0872d4b2 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_pulse_powered.png differ diff --git a/src/main/resources/assets/create/textures/block/belt_observer_split.png b/src/main/resources/assets/create/textures/block/belt_observer_split.png new file mode 100644 index 000000000..9522f1eb9 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_split.png differ diff --git a/src/main/resources/assets/create/textures/block/belt_observer_split_powered.png b/src/main/resources/assets/create/textures/block/belt_observer_split_powered.png new file mode 100644 index 000000000..fd825ceae Binary files /dev/null and b/src/main/resources/assets/create/textures/block/belt_observer_split_powered.png differ diff --git a/src/main/resources/assets/create/textures/block/clutch_off.png b/src/main/resources/assets/create/textures/block/clutch_off.png index 986a44002..2988f8b8f 100644 Binary files a/src/main/resources/assets/create/textures/block/clutch_off.png and b/src/main/resources/assets/create/textures/block/clutch_off.png differ diff --git a/src/main/resources/assets/create/textures/block/entity_detector_off.png b/src/main/resources/assets/create/textures/block/entity_detector_off.png deleted file mode 100644 index 4c05885d8..000000000 Binary files a/src/main/resources/assets/create/textures/block/entity_detector_off.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/block/entity_detector_on.png b/src/main/resources/assets/create/textures/block/entity_detector_on.png deleted file mode 100644 index 7065ec314..000000000 Binary files a/src/main/resources/assets/create/textures/block/entity_detector_on.png and /dev/null differ