diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 6c6dd126e..691ed4dcf 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -5336,6 +5336,7 @@ ad8fa04f7bbbafd70d0ce158af78a35e899301e2 data/create/tags/blocks/tracks.json 50936b211d94167a35ec78c89954082a336b6269 data/create/tags/blocks/valve_handles.json eac71740fb12bdb38b5dfaa2268613d7ba82b809 data/create/tags/blocks/windmill_sails.json 9851b3bef451f326ef322a31f85b9a970859590d data/create/tags/blocks/wrench_pickup.json +74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/entity_types/ignore_seat.json a8bdc387cfa6296ebcc4af14323e2ddb632234dc data/create/tags/fluids/bottomless/allow.json 74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/fluids/bottomless/deny.json 74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/items/blaze_burner_fuel/regular.json diff --git a/src/generated/resources/data/create/tags/entity_types/ignore_seat.json b/src/generated/resources/data/create/tags/entity_types/ignore_seat.json new file mode 100644 index 000000000..5e8aecc98 --- /dev/null +++ b/src/generated/resources/data/create/tags/entity_types/ignore_seat.json @@ -0,0 +1,4 @@ +{ + "replace": false, + "values": [] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index 0f63e5ebb..5ced385af 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -9,11 +9,14 @@ import java.util.Collections; import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -49,6 +52,7 @@ public class AllTags { } public enum NameSpace { + MOD(Create.ID, false, true), FORGE("forge"), TIC("tconstruct"), @@ -72,6 +76,7 @@ public class AllTags { } public enum AllBlockTags { + BRITTLE, CASING, FAN_TRANSPARENT, @@ -143,11 +148,12 @@ public class AllTags { return state.is(tag); } - private static void init() { - } + private static void init() {} + } public enum AllItemTags { + BLAZE_BURNER_FUEL_REGULAR(MOD, "blaze_burner_fuel/regular"), BLAZE_BURNER_FUEL_SPECIAL(MOD, "blaze_burner_fuel/special"), CASING, @@ -213,11 +219,12 @@ public class AllTags { return stack.is(tag); } - private static void init() { - } + private static void init() {} + } public enum AllFluidTags { + BOTTOMLESS_ALLOW(MOD, "bottomless/allow"), BOTTOMLESS_DENY(MOD, "bottomless/deny"), @@ -263,13 +270,58 @@ public class AllTags { return state.is(tag); } - private static void init() { + private static void init() {} + + } + + public enum AllEntityTags { + + IGNORE_SEAT, + + ; + + public final TagKey> tag; + public final boolean alwaysDatagen; + + AllEntityTags() { + this(MOD); } + + AllEntityTags(NameSpace namespace) { + this(namespace, namespace.optionalDefault, namespace.alwaysDatagenDefault); + } + + AllEntityTags(NameSpace namespace, String path) { + this(namespace, path, namespace.optionalDefault, namespace.alwaysDatagenDefault); + } + + AllEntityTags(NameSpace namespace, boolean optional, boolean alwaysDatagen) { + this(namespace, null, optional, alwaysDatagen); + } + + AllEntityTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) { + ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path); + if (optional) { + tag = optionalTag(ForgeRegistries.ENTITIES, id); + } else { + tag = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, id); + } + this.alwaysDatagen = alwaysDatagen; + } + + public boolean matches(Entity entity) { + return entity.getType() + .is(tag); + } + + private static void init() {} + } public static void init() { AllBlockTags.init(); AllItemTags.init(); AllFluidTags.init(); + AllEntityTags.init(); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java b/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java index a96151938..43df04328 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java @@ -8,8 +8,10 @@ import javax.annotation.ParametersAreNonnullByDefault; import com.google.common.base.Optional; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; +import com.simibubi.create.AllTags.AllEntityTags; import com.simibubi.create.foundation.block.ProperWaterloggedBlock; import com.simibubi.create.foundation.utility.BlockHelper; +import com.simibubi.create.infrastructure.config.AllConfigs; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -189,6 +191,12 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock { return false; if (passenger instanceof Player) return false; + if (AllEntityTags.IGNORE_SEAT.matches(passenger)) + return false; + if (!AllConfigs.server().logistics.seatHostileMobs.get() && !passenger.getType() + .getCategory() + .isFriendly()) + return false; return passenger instanceof LivingEntity; } diff --git a/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlock.java b/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlock.java index 2061dbefb..94b4db68b 100644 --- a/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlock.java +++ b/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlock.java @@ -133,12 +133,12 @@ public class SmartObserverBlock extends DirectedDirectionalBlock implements IBE< } public void onFunnelTransfer(Level world, BlockPos funnelPos, ItemStack transferred) { - for (Direction direction : Iterate.horizontalDirections) { + for (Direction direction : Iterate.directions) { BlockPos detectorPos = funnelPos.relative(direction); BlockState detectorState = world.getBlockState(detectorPos); if (!AllBlocks.SMART_OBSERVER.has(detectorState)) continue; - if (detectorState.getValue(FACING) != direction.getOpposite()) + if (SmartObserverBlock.getTargetDirection(detectorState) != direction.getOpposite()) continue; withBlockEntityDo(world, detectorPos, be -> { FilteringBehaviour filteringBehaviour = BlockEntityBehaviour.get(be, FilteringBehaviour.TYPE); diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackPlacementOverlay.java b/src/main/java/com/simibubi/create/content/trains/track/TrackPlacementOverlay.java index b8fadc205..78693d221 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackPlacementOverlay.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackPlacementOverlay.java @@ -35,9 +35,9 @@ public class TrackPlacementOverlay { return; if (TrackPlacement.extraTipWarmup < 4) return; - + if (ObfuscationReflectionHelper.getPrivateValue(Gui.class, gui, - "toolHighlightTimer") instanceof Integer toolHighlightTimer && toolHighlightTimer > 0) + "f_92993_") instanceof Integer toolHighlightTimer && toolHighlightTimer > 0) return; boolean active = mc.options.keySprint.isDown(); diff --git a/src/main/java/com/simibubi/create/foundation/data/TagGen.java b/src/main/java/com/simibubi/create/foundation/data/TagGen.java index eb90bd682..0fe706f4e 100644 --- a/src/main/java/com/simibubi/create/foundation/data/TagGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/TagGen.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.data; import com.simibubi.create.AllTags; import com.simibubi.create.AllTags.AllBlockTags; +import com.simibubi.create.AllTags.AllEntityTags; import com.simibubi.create.AllTags.AllFluidTags; import com.simibubi.create.AllTags.AllItemTags; import com.simibubi.create.Create; @@ -15,6 +16,7 @@ import com.tterrag.registrate.util.nullness.NonNullFunction; import net.minecraft.data.tags.TagsProvider.TagAppender; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -66,6 +68,7 @@ public class TagGen { Create.REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, TagGen::genBlockTags); Create.REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, TagGen::genItemTags); Create.REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, TagGen::genFluidTags); + Create.REGISTRATE.addDataGenerator(ProviderType.ENTITY_TAGS, TagGen::genEntityTags); } private static void genBlockTags(RegistrateTagsProvider prov) { @@ -226,6 +229,17 @@ public class TagGen { } } + private static void genEntityTags(RegistrateTagsProvider> prov) { + + // VALIDATE + + for (AllEntityTags tag : AllEntityTags.values()) { + if (tag.alwaysDatagen) { + prov.getOrCreateRawBuilder(tag.tag); + } + } + } + private static class StrippedWoodHelper { protected final TagAppender logAppender; protected final TagAppender woodAppender; @@ -244,4 +258,5 @@ public class TagGen { } } } + } diff --git a/src/main/java/com/simibubi/create/infrastructure/config/CLogistics.java b/src/main/java/com/simibubi/create/infrastructure/config/CLogistics.java index 0d08b264e..3cff341ab 100644 --- a/src/main/java/com/simibubi/create/infrastructure/config/CLogistics.java +++ b/src/main/java/com/simibubi/create/infrastructure/config/CLogistics.java @@ -11,6 +11,7 @@ public class CLogistics extends ConfigBase { public final ConfigInt displayLinkRange = i(64, 1, "displayLinkRange", Comments.displayLinkRange); public final ConfigInt vaultCapacity = i(20, 1, "vaultCapacity", Comments.vaultCapacity); public final ConfigInt brassTunnelTimer = i(10, 1, 10, "brassTunnelTimer", Comments.brassTunnelTimer); + public final ConfigBool seatHostileMobs = b(true, "seatHostileMobs", Comments.seatHostileMobs); @Override public String getName() { @@ -28,6 +29,7 @@ public class CLogistics extends ConfigBase { static String mechanicalArmRange = "Maximum distance in blocks a Mechanical Arm can reach across."; static String vaultCapacity = "The total amount of stacks a vault can hold per block in size."; static String brassTunnelTimer = "The amount of ticks a brass tunnel waits between distributions."; + static String seatHostileMobs = "Whether hostile mobs walking near a seat will start riding it."; } } diff --git a/src/main/resources/assets/create/models/block/redstone_link/receiver_powered.json b/src/main/resources/assets/create/models/block/redstone_link/receiver_powered.json index eab866aed..94c5b4850 100644 --- a/src/main/resources/assets/create/models/block/redstone_link/receiver_powered.json +++ b/src/main/resources/assets/create/models/block/redstone_link/receiver_powered.json @@ -57,8 +57,8 @@ } }, { - "from": [6.1, 2.5, 3.6], - "to": [9.9, 3.5, 7.4], + "from": [6, 2.5, 3.5], + "to": [10, 3.5, 7.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, @@ -68,8 +68,8 @@ } }, { - "from": [6.1, 2.5, 8.6], - "to": [9.9, 3.5, 12.4], + "from": [6, 2.5, 8.5], + "to": [10, 3.5, 12.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, diff --git a/src/main/resources/assets/create/models/block/redstone_link/receiver_vertical_powered.json b/src/main/resources/assets/create/models/block/redstone_link/receiver_vertical_powered.json index 7a1ee91fe..8d6ea22e9 100644 --- a/src/main/resources/assets/create/models/block/redstone_link/receiver_vertical_powered.json +++ b/src/main/resources/assets/create/models/block/redstone_link/receiver_vertical_powered.json @@ -57,8 +57,8 @@ } }, { - "from": [6.1, 2.5, 3.6], - "to": [9.9, 3.5, 7.4], + "from": [6, 2.5, 3.5], + "to": [10, 3.5, 7.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, @@ -68,8 +68,8 @@ } }, { - "from": [6.1, 2.5, 8.6], - "to": [9.9, 3.5, 12.4], + "from": [6, 2.5, 8.5], + "to": [10, 3.5, 12.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, diff --git a/src/main/resources/assets/create/models/block/redstone_link/transmitter_powered.json b/src/main/resources/assets/create/models/block/redstone_link/transmitter_powered.json index 633007a5e..2f17ec42c 100644 --- a/src/main/resources/assets/create/models/block/redstone_link/transmitter_powered.json +++ b/src/main/resources/assets/create/models/block/redstone_link/transmitter_powered.json @@ -48,8 +48,8 @@ } }, { - "from": [6.1, 2.5, 3.6], - "to": [9.9, 3.5, 7.4], + "from": [6, 2.5, 3.5], + "to": [10, 3.5, 7.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, @@ -59,8 +59,8 @@ } }, { - "from": [6.1, 2.5, 8.6], - "to": [9.9, 3.5, 12.4], + "from": [6, 2.5, 8.5], + "to": [10, 3.5, 12.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge"}, diff --git a/src/main/resources/assets/create/models/block/redstone_link/transmitter_vertical_powered.json b/src/main/resources/assets/create/models/block/redstone_link/transmitter_vertical_powered.json index bc79632b5..695506c9b 100644 --- a/src/main/resources/assets/create/models/block/redstone_link/transmitter_vertical_powered.json +++ b/src/main/resources/assets/create/models/block/redstone_link/transmitter_vertical_powered.json @@ -48,8 +48,8 @@ } }, { - "from": [6.1, 2.5, 3.6], - "to": [9.9, 3.5, 7.4], + "from": [6, 2.5, 3.5], + "to": [10, 3.5, 7.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, @@ -59,8 +59,8 @@ } }, { - "from": [6.1, 2.5, 8.6], - "to": [9.9, 3.5, 12.4], + "from": [6, 2.5, 8.5], + "to": [10, 3.5, 12.5], "faces": { "north": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"}, "east": {"uv": [11, 2, 13, 2.5], "texture": "#redstone_bridge_side"},