Tagging along
- Fix glowing shader for 1.18.2 - Optimize and compress tag code - Convert MovementBehaviour to interface - Remove manual refmap remapping as it is no longer necessary - Update Gradle
This commit is contained in:
parent
1525cbb14b
commit
b32c83e74d
47 changed files with 195 additions and 198 deletions
|
@ -48,8 +48,6 @@ minecraft {
|
||||||
arg '-mixin.config=flywheel.mixins.json'
|
arg '-mixin.config=flywheel.mixins.json'
|
||||||
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
|
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
|
||||||
property 'forge.logging.console.level', 'info'
|
property 'forge.logging.console.level', 'info'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
||||||
mods {
|
mods {
|
||||||
create {
|
create {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
|
@ -67,8 +65,6 @@ minecraft {
|
||||||
workingDirectory project.file('run/server')
|
workingDirectory project.file('run/server')
|
||||||
arg '-mixin.config=create.mixins.json'
|
arg '-mixin.config=create.mixins.json'
|
||||||
property 'forge.logging.console.level', 'info'
|
property 'forge.logging.console.level', 'info'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
||||||
mods {
|
mods {
|
||||||
create {
|
create {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
|
@ -80,8 +76,6 @@ minecraft {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
|
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
||||||
args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')
|
args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')
|
||||||
mods {
|
mods {
|
||||||
create {
|
create {
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
10
gradlew
vendored
10
gradlew
vendored
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -32,10 +32,10 @@
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
# * functions;
|
# * functions;
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
#
|
#
|
||||||
# Important for patching:
|
# Important for patching:
|
||||||
#
|
#
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class AllItems {
|
||||||
public static final ItemEntry<? extends CopperArmorItem>
|
public static final ItemEntry<? extends CopperArmorItem>
|
||||||
|
|
||||||
COPPER_BACKTANK = REGISTRATE.item("copper_backtank", p -> new CopperBacktankItem(p, COPPER_BACKTANK_PLACEABLE))
|
COPPER_BACKTANK = REGISTRATE.item("copper_backtank", p -> new CopperBacktankItem(p, COPPER_BACKTANK_PLACEABLE))
|
||||||
.model(AssetLookup.<CopperBacktankItem>customGenericItemModel("_", "item"))
|
.model(AssetLookup.customGenericItemModel("_", "item"))
|
||||||
.register(),
|
.register(),
|
||||||
|
|
||||||
DIVING_HELMET = REGISTRATE.item("diving_helmet", DivingHelmetItem::new)
|
DIVING_HELMET = REGISTRATE.item("diving_helmet", DivingHelmetItem::new)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import static com.simibubi.create.AllTags.NameSpace.MOD;
|
||||||
import static com.simibubi.create.AllTags.NameSpace.TIC;
|
import static com.simibubi.create.AllTags.NameSpace.TIC;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
@ -16,6 +15,8 @@ import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.tags.FluidTags;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
@ -25,37 +26,36 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||||
|
|
||||||
public class AllTags {
|
public class AllTags {
|
||||||
|
|
||||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||||
.creativeModeTab(() -> Create.BASE_CREATIVE_TAB);
|
.creativeModeTab(() -> Create.BASE_CREATIVE_TAB);
|
||||||
|
|
||||||
public static <T> TagKey<T> tag(Function<ResourceLocation, TagKey<T>> wrapperFactory, String namespace,
|
public static <T extends IForgeRegistryEntry<T>> TagKey<T> optionalTag(IForgeRegistry<T> registry, ResourceLocation id) {
|
||||||
String path) {
|
return registry.tags().createOptionalTagKey(id, Collections.emptySet());
|
||||||
return wrapperFactory.apply(new ResourceLocation(namespace, path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> TagKey<T> forgeTag(Function<ResourceLocation, TagKey<T>> wrapperFactory, String path) {
|
public static <T extends IForgeRegistryEntry<T>> TagKey<T> forgeTag(IForgeRegistry<T> registry, String path) {
|
||||||
return tag(wrapperFactory, "forge", path);
|
return optionalTag(registry, new ResourceLocation("forge", path));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TagKey<Block> forgeBlockTag(String path) {
|
public static TagKey<Block> forgeBlockTag(String path) {
|
||||||
return forgeTag(r -> ForgeRegistries.BLOCKS.tags()
|
return forgeTag(ForgeRegistries.BLOCKS, path);
|
||||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TagKey<Item> forgeItemTag(String path) {
|
public static TagKey<Item> forgeItemTag(String path) {
|
||||||
return forgeTag(r -> ForgeRegistries.ITEMS.tags()
|
return forgeTag(ForgeRegistries.ITEMS, path);
|
||||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TagKey<Fluid> forgeFluidTag(String path) {
|
public static TagKey<Fluid> forgeFluidTag(String path) {
|
||||||
return forgeTag(r -> ForgeRegistries.FLUIDS.tags()
|
return forgeTag(ForgeRegistries.FLUIDS, path);
|
||||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, BlockBuilder<T, P>> axeOrPickaxe() {
|
public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, BlockBuilder<T, P>> axeOrPickaxe() {
|
||||||
|
@ -85,7 +85,9 @@ public class AllTags {
|
||||||
|
|
||||||
public enum NameSpace {
|
public enum NameSpace {
|
||||||
|
|
||||||
MOD(Create.ID, false, true), FORGE("forge"), TIC("tconstruct")
|
MOD(Create.ID, false, true),
|
||||||
|
FORGE("forge"),
|
||||||
|
TIC("tconstruct")
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -119,8 +121,8 @@ public class AllTags {
|
||||||
WINDOWABLE,
|
WINDOWABLE,
|
||||||
WRENCH_PICKUP,
|
WRENCH_PICKUP,
|
||||||
|
|
||||||
WG_STONE(FORGE),
|
|
||||||
RELOCATION_NOT_SUPPORTED(FORGE),
|
RELOCATION_NOT_SUPPORTED(FORGE),
|
||||||
|
WG_STONE(FORGE),
|
||||||
|
|
||||||
SLIMY_LOGS(TIC),
|
SLIMY_LOGS(TIC),
|
||||||
|
|
||||||
|
@ -147,24 +149,22 @@ public class AllTags {
|
||||||
AllBlockTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
AllBlockTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||||
if (optional) {
|
if (optional) {
|
||||||
tag = ForgeRegistries.BLOCKS.tags()
|
tag = optionalTag(ForgeRegistries.BLOCKS, id);
|
||||||
.createOptionalTagKey(id, Collections.emptySet());
|
|
||||||
} else {
|
} else {
|
||||||
tag = TagKey.create(ForgeRegistries.BLOCKS.getRegistryKey(), id);
|
tag = BlockTags.create(id);
|
||||||
}
|
}
|
||||||
if (alwaysDatagen) {
|
if (alwaysDatagen) {
|
||||||
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag));
|
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean matches(Block block) {
|
public boolean matches(Block block) {
|
||||||
return ForgeRegistries.BLOCKS.getHolder(block)
|
return block.builtInRegistryHolder().is(tag);
|
||||||
.map(h -> h.containsTag(tag))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(BlockState state) {
|
public boolean matches(BlockState state) {
|
||||||
return matches(state.getBlock());
|
return state.is(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Block... values) {
|
public void add(Block... values) {
|
||||||
|
@ -226,20 +226,22 @@ public class AllTags {
|
||||||
AllItemTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
AllItemTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||||
if (optional) {
|
if (optional) {
|
||||||
tag = ForgeRegistries.ITEMS.tags()
|
tag = optionalTag(ForgeRegistries.ITEMS, id);
|
||||||
.createOptionalTagKey(id, Collections.emptySet());
|
|
||||||
} else {
|
} else {
|
||||||
tag = TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), id);
|
tag = ItemTags.create(id);
|
||||||
}
|
}
|
||||||
if (alwaysDatagen) {
|
if (alwaysDatagen) {
|
||||||
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag));
|
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean matches(Item item) {
|
||||||
|
return item.builtInRegistryHolder().is(tag);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
public boolean matches(ItemStack stack) {
|
||||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
return stack.is(tag);
|
||||||
.map(h -> h.containsTag(tag))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Item... values) {
|
public void add(Item... values) {
|
||||||
|
@ -293,19 +295,22 @@ public class AllTags {
|
||||||
AllFluidTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
AllFluidTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||||
if (optional) {
|
if (optional) {
|
||||||
tag = ForgeRegistries.FLUIDS.tags()
|
tag = optionalTag(ForgeRegistries.FLUIDS, id);
|
||||||
.createOptionalTagKey(id, Collections.emptySet());
|
|
||||||
} else {
|
} else {
|
||||||
tag = TagKey.create(ForgeRegistries.FLUIDS.getRegistryKey(), id);
|
tag = FluidTags.create(id);
|
||||||
}
|
}
|
||||||
if (alwaysDatagen)
|
if (alwaysDatagen) {
|
||||||
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag));
|
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean matches(Fluid fluid) {
|
public boolean matches(Fluid fluid) {
|
||||||
return fluid != null && ForgeRegistries.FLUIDS.getHolder(fluid)
|
return fluid.is(tag);
|
||||||
.map(h -> h.containsTag(tag))
|
}
|
||||||
.orElse(false);
|
|
||||||
|
public boolean matches(FluidState state) {
|
||||||
|
return state.is(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Fluid... values) {
|
public void add(Fluid... values) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BellMovementBehaviour extends MovementBehaviour {
|
public class BellMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalTileEntity() {
|
public boolean renderAsNormalTileEntity() {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BlockBreakingMovementBehaviour extends MovementBehaviour {
|
public class BlockBreakingMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startMoving(MovementContext context) {
|
public void startMoving(MovementContext context) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.world.level.block.CampfireBlock;
|
import net.minecraft.world.level.block.CampfireBlock;
|
||||||
|
|
||||||
public class CampfireMovementBehaviour extends MovementBehaviour {
|
public class CampfireMovementBehaviour implements MovementBehaviour {
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalTileEntity() {
|
public boolean renderAsNormalTileEntity() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.world.level.block.state.properties.Property;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
|
||||||
public class HarvesterMovementBehaviour extends MovementBehaviour {
|
public class HarvesterMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive(MovementContext context) {
|
public boolean isActive(MovementContext context) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public class PortableStorageInterfaceMovement extends MovementBehaviour {
|
public class PortableStorageInterfaceMovement implements MovementBehaviour {
|
||||||
|
|
||||||
static final String _workingPos_ = "WorkingPos";
|
static final String _workingPos_ = "WorkingPos";
|
||||||
static final String _clientPrevPos_ = "ClientPrevPos";
|
static final String _clientPrevPos_ = "ClientPrevPos";
|
||||||
|
|
|
@ -17,11 +17,11 @@ import net.minecraft.world.level.block.state.properties.SlabType;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class SeatMovementBehaviour extends MovementBehaviour {
|
public class SeatMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startMoving(MovementContext context) {
|
public void startMoving(MovementContext context) {
|
||||||
super.startMoving(context);
|
MovementBehaviour.super.startMoving(context);
|
||||||
int indexOf = context.contraption.getSeats()
|
int indexOf = context.contraption.getSeats()
|
||||||
.indexOf(context.localPos);
|
.indexOf(context.localPos);
|
||||||
context.data.putInt("SeatIndex", indexOf);
|
context.data.putInt("SeatIndex", indexOf);
|
||||||
|
@ -29,7 +29,7 @@ public class SeatMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||||
super.visitNewPosition(context, pos);
|
MovementBehaviour.super.visitNewPosition(context, pos);
|
||||||
|
|
||||||
AbstractContraptionEntity contraptionEntity = context.contraption.entity;
|
AbstractContraptionEntity contraptionEntity = context.contraption.entity;
|
||||||
if (contraptionEntity == null)
|
if (contraptionEntity == null)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
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 HashMap<Item, IMovedDispenseItemBehaviour> MOVED_PROJECTILE_DISPENSE_BEHAVIOURS = new HashMap<>();
|
private static final HashMap<Item, IMovedDispenseItemBehaviour> MOVED_PROJECTILE_DISPENSE_BEHAVIOURS = new HashMap<>();
|
||||||
private static boolean spawneggsRegistered = false;
|
private static boolean spawnEggsRegistered = false;
|
||||||
|
|
||||||
public static void gatherMovedDispenseItemBehaviours() {
|
public static void gatherMovedDispenseItemBehaviours() {
|
||||||
IMovedDispenseItemBehaviour.init();
|
IMovedDispenseItemBehaviour.init();
|
||||||
|
@ -36,35 +36,35 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void activate(MovementContext context, BlockPos pos) {
|
protected void activate(MovementContext context, BlockPos pos) {
|
||||||
if (!spawneggsRegistered) {
|
if (!spawnEggsRegistered) {
|
||||||
spawneggsRegistered = true;
|
spawnEggsRegistered = true;
|
||||||
IMovedDispenseItemBehaviour.initSpawneggs();
|
IMovedDispenseItemBehaviour.initSpawnEggs();
|
||||||
}
|
}
|
||||||
|
|
||||||
DispenseItemLocation location = getDispenseLocation(context);
|
DispenseItemLocation location = getDispenseLocation(context);
|
||||||
if (location.isEmpty()) {
|
if (location.isEmpty()) {
|
||||||
context.world.levelEvent(1001, pos, 0);
|
context.world.levelEvent(1001, pos, 0);
|
||||||
} else {
|
} else {
|
||||||
ItemStack itemstack = getItemStackAt(location, context);
|
ItemStack itemStack = getItemStackAt(location, context);
|
||||||
// Special dispense item behaviour for moving contraptions
|
// Special dispense item behaviour for moving contraptions
|
||||||
if (MOVED_DISPENSE_ITEM_BEHAVIOURS.containsKey(itemstack.getItem())) {
|
if (MOVED_DISPENSE_ITEM_BEHAVIOURS.containsKey(itemStack.getItem())) {
|
||||||
setItemStackAt(location, MOVED_DISPENSE_ITEM_BEHAVIOURS.get(itemstack.getItem()).dispense(itemstack, context, pos), context);
|
setItemStackAt(location, MOVED_DISPENSE_ITEM_BEHAVIOURS.get(itemStack.getItem()).dispense(itemStack, context, pos), context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack backup = itemstack.copy();
|
ItemStack backup = itemStack.copy();
|
||||||
// If none is there, try vanilla registry
|
// If none is there, try vanilla registry
|
||||||
try {
|
try {
|
||||||
if (MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.containsKey(itemstack.getItem())) {
|
if (MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.containsKey(itemStack.getItem())) {
|
||||||
setItemStackAt(location, MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.get(itemstack.getItem()).dispense(itemstack, context, pos), context);
|
setItemStackAt(location, MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.get(itemStack.getItem()).dispense(itemStack, context, pos), context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DispenseItemBehavior idispenseitembehavior = getDispenseMethod(itemstack);
|
DispenseItemBehavior behavior = getDispenseMethod(itemStack);
|
||||||
if (idispenseitembehavior instanceof AbstractProjectileDispenseBehavior) { // Projectile behaviours can be converted most of the time
|
if (behavior instanceof AbstractProjectileDispenseBehavior) { // Projectile behaviours can be converted most of the time
|
||||||
IMovedDispenseItemBehaviour iMovedDispenseItemBehaviour = MovedProjectileDispenserBehaviour.of((AbstractProjectileDispenseBehavior) idispenseitembehavior);
|
IMovedDispenseItemBehaviour movedBehaviour = MovedProjectileDispenserBehaviour.of((AbstractProjectileDispenseBehavior) behavior);
|
||||||
setItemStackAt(location, iMovedDispenseItemBehaviour.dispense(itemstack, context, pos), context);
|
setItemStackAt(location, movedBehaviour.dispense(itemStack, context, pos), context);
|
||||||
MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.put(itemstack.getItem(), iMovedDispenseItemBehaviour); // buffer conversion if successful
|
MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.put(itemStack.getItem(), movedBehaviour); // buffer conversion if successful
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,15 +74,15 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
Direction clostestFacing = Direction.getNearest(facingVec.x, facingVec.y, facingVec.z);
|
Direction clostestFacing = Direction.getNearest(facingVec.x, facingVec.y, facingVec.z);
|
||||||
ContraptionBlockSource blockSource = new ContraptionBlockSource(context, pos, clostestFacing);
|
ContraptionBlockSource blockSource = new ContraptionBlockSource(context, pos, clostestFacing);
|
||||||
|
|
||||||
if (idispenseitembehavior.getClass() != DefaultDispenseItemBehavior.class) { // There is a dispense item behaviour registered for the vanilla dispenser
|
if (behavior.getClass() != DefaultDispenseItemBehavior.class) { // There is a dispense item behaviour registered for the vanilla dispenser
|
||||||
setItemStackAt(location, idispenseitembehavior.dispense(blockSource, itemstack), context);
|
setItemStackAt(location, behavior.dispense(blockSource, itemStack), context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (NullPointerException ignored) {
|
} catch (NullPointerException ignored) {
|
||||||
itemstack = backup; // Something went wrong with the TE being null in ContraptionBlockSource, reset the stack
|
itemStack = backup; // Something went wrong with the TE being null in ContraptionBlockSource, reset the stack
|
||||||
}
|
}
|
||||||
|
|
||||||
setItemStackAt(location, defaultBehaviour.dispense(itemstack, context, pos), context); // the default: launch the item
|
setItemStackAt(location, DEFAULT_BEHAVIOUR.dispense(itemStack, context, pos), context); // the default: launch the item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraft.world.ContainerHelper;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
|
||||||
public class DropperMovementBehaviour extends MovementBehaviour {
|
public class DropperMovementBehaviour implements MovementBehaviour {
|
||||||
protected static final MovedDefaultDispenseItemBehaviour defaultBehaviour = new MovedDefaultDispenseItemBehaviour();
|
protected static final MovedDefaultDispenseItemBehaviour DEFAULT_BEHAVIOUR = new MovedDefaultDispenseItemBehaviour();
|
||||||
private static final Random RNG = new Random();
|
private static final Random RNG = new Random();
|
||||||
|
|
||||||
protected void activate(MovementContext context, BlockPos pos) {
|
protected void activate(MovementContext context, BlockPos pos) {
|
||||||
|
@ -23,7 +23,7 @@ public class DropperMovementBehaviour extends MovementBehaviour {
|
||||||
if (location.isEmpty()) {
|
if (location.isEmpty()) {
|
||||||
context.world.levelEvent(1001, pos, 0);
|
context.world.levelEvent(1001, pos, 0);
|
||||||
} else {
|
} else {
|
||||||
setItemStackAt(location, defaultBehaviour.dispense(getItemStackAt(location, context), context, pos), context);
|
setItemStackAt(location, DEFAULT_BEHAVIOUR.dispense(getItemStackAt(location, context), context, pos), context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class DropperMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopMoving(MovementContext context) {
|
public void stopMoving(MovementContext context) {
|
||||||
super.stopMoving(context);
|
MovementBehaviour.super.stopMoving(context);
|
||||||
writeExtraData(context);
|
writeExtraData(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public interface IMovedDispenseItemBehaviour {
|
public interface IMovedDispenseItemBehaviour {
|
||||||
|
|
||||||
static void initSpawneggs() {
|
static void initSpawnEggs() {
|
||||||
final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() {
|
final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() {
|
||||||
@Override
|
@Override
|
||||||
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3 facing) {
|
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3 facing) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour {
|
public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour {
|
||||||
private static final MovedDefaultDispenseItemBehaviour defaultInstance = new MovedDefaultDispenseItemBehaviour();
|
private static final MovedDefaultDispenseItemBehaviour DEFAULT_INSTANCE = new MovedDefaultDispenseItemBehaviour();
|
||||||
|
|
||||||
public static void doDispense(Level p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vec3 facing, BlockPos p_82486_4_, MovementContext context) {
|
public static void doDispense(Level p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vec3 facing, BlockPos p_82486_4_, MovementContext context) {
|
||||||
double d0 = p_82486_4_.getX() + facing.x + .5;
|
double d0 = p_82486_4_.getX() + facing.x + .5;
|
||||||
|
@ -87,7 +87,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
||||||
consumedFrom.shrink(1);
|
consumedFrom.shrink(1);
|
||||||
ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false);
|
ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false);
|
||||||
if (!remainder.isEmpty())
|
if (!remainder.isEmpty())
|
||||||
defaultInstance.dispenseStack(output, context, pos, facing);
|
DEFAULT_INSTANCE.dispenseStack(output, context, pos, facing);
|
||||||
return consumedFrom;
|
return consumedFrom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,20 +145,19 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
// Output Items
|
// Output Items
|
||||||
if (facing != Direction.UP) {
|
if (facing != Direction.UP) {
|
||||||
Direction inputDir = facing;
|
|
||||||
BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f),
|
BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f),
|
||||||
facing.getAxis() == Axis.Z ? 1f * offset : 0f);
|
facing.getAxis() == Axis.Z ? 1f * offset : 0f);
|
||||||
DirectBeltInputBehaviour behaviour =
|
DirectBeltInputBehaviour behaviour =
|
||||||
TileEntityBehaviour.get(level, nextPos, DirectBeltInputBehaviour.TYPE);
|
TileEntityBehaviour.get(level, nextPos, DirectBeltInputBehaviour.TYPE);
|
||||||
if (behaviour != null) {
|
if (behaviour != null) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
if (!behaviour.canInsertFromSide(inputDir))
|
if (!behaviour.canInsertFromSide(facing))
|
||||||
return;
|
return;
|
||||||
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
||||||
ItemStack stack = inventory.getStackInSlot(slot);
|
ItemStack stack = inventory.getStackInSlot(slot);
|
||||||
if (stack.isEmpty())
|
if (stack.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
ItemStack remainder = behaviour.handleInsertion(stack, inputDir, false);
|
ItemStack remainder = behaviour.handleInsertion(stack, facing, false);
|
||||||
if (remainder.equals(stack, false))
|
if (remainder.equals(stack, false))
|
||||||
continue;
|
continue;
|
||||||
inventory.setStackInSlot(slot, remainder);
|
inventory.setStackInSlot(slot, remainder);
|
||||||
|
|
|
@ -47,7 +47,7 @@ import net.minecraftforge.common.util.BlockSnapshot;
|
||||||
import net.minecraftforge.event.ForgeEventFactory;
|
import net.minecraftforge.event.ForgeEventFactory;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
public class DeployerMovementBehaviour extends MovementBehaviour {
|
public class DeployerMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
||||||
return false;
|
return false;
|
||||||
BlockState checkState = level.getBlockState(worldPosition.below());
|
BlockState checkState = level.getBlockState(worldPosition.below());
|
||||||
|
|
||||||
if (!checkState.is(AllBlockTags.FAN_HEATERS.tag))
|
if (!AllBlockTags.FAN_HEATERS.matches(checkState))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (checkState.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) && !checkState.getValue(BlazeBurnerBlock.HEAT_LEVEL)
|
if (checkState.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) && !checkState.getValue(BlazeBurnerBlock.HEAT_LEVEL)
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class BlockMovementChecks {
|
||||||
return true;
|
return true;
|
||||||
if (block instanceof WoolCarpetBlock)
|
if (block instanceof WoolCarpetBlock)
|
||||||
return true;
|
return true;
|
||||||
return AllBlockTags.BRITTLE.matches(block);
|
return AllBlockTags.BRITTLE.matches(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isBlockAttachedTowardsFallback(BlockState state, Level world, BlockPos pos,
|
private static boolean isBlockAttachedTowardsFallback(BlockState state, Level world, BlockPos pos,
|
||||||
|
|
|
@ -17,23 +17,26 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
public abstract class MovementBehaviour {
|
public interface MovementBehaviour {
|
||||||
|
|
||||||
public boolean isActive(MovementContext context) {
|
default boolean isActive(MovementContext context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(MovementContext context) {}
|
default void tick(MovementContext context) {
|
||||||
|
}
|
||||||
|
|
||||||
public void startMoving(MovementContext context) {}
|
default void startMoving(MovementContext context) {
|
||||||
|
}
|
||||||
|
|
||||||
public void visitNewPosition(MovementContext context, BlockPos pos) {}
|
default void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||||
|
}
|
||||||
|
|
||||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
default Vec3 getActiveAreaOffset(MovementContext context) {
|
||||||
return Vec3.ZERO;
|
return Vec3.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropItem(MovementContext context, ItemStack stack) {
|
default void dropItem(MovementContext context, ItemStack stack) {
|
||||||
ItemStack remainder;
|
ItemStack remainder;
|
||||||
if (AllConfigs.SERVER.kinetics.moveItemsToStorage.get())
|
if (AllConfigs.SERVER.kinetics.moveItemsToStorage.get())
|
||||||
remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, stack, false);
|
remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, stack, false);
|
||||||
|
@ -49,32 +52,31 @@ public abstract class MovementBehaviour {
|
||||||
context.world.addFreshEntity(itemEntity);
|
context.world.addFreshEntity(itemEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopMoving(MovementContext context) {
|
default void onSpeedChanged(MovementContext context, Vec3 oldMotion, Vec3 motion) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeExtraData(MovementContext context) {
|
default void stopMoving(MovementContext context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean renderAsNormalTileEntity() {
|
default void writeExtraData(MovementContext context) {
|
||||||
|
}
|
||||||
|
|
||||||
|
default boolean renderAsNormalTileEntity() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSpecialInstancedRendering() {
|
default boolean hasSpecialInstancedRendering() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
default void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||||
ContraptionMatrices matrices, MultiBufferSource buffer) {}
|
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||||
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Nullable
|
@Nullable
|
||||||
public ActorInstance createInstance(MaterialManager materialManager, VirtualRenderWorld simulationWorld, MovementContext context) {
|
default ActorInstance createInstance(MaterialManager materialManager, VirtualRenderWorld simulationWorld, MovementContext context) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSpeedChanged(MovementContext context, Vec3 oldMotion, Vec3 motion) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
public class StabilizedBearingMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraftforge.client.model.data.ModelProperty;
|
||||||
|
|
||||||
public class FluidTankModel extends CTModel {
|
public class FluidTankModel extends CTModel {
|
||||||
|
|
||||||
protected static ModelProperty<CullData> CULL_PROPERTY = new ModelProperty<>();
|
protected static final ModelProperty<CullData> CULL_PROPERTY = new ModelProperty<>();
|
||||||
|
|
||||||
public static FluidTankModel standard(BakedModel originalModel) {
|
public static FluidTankModel standard(BakedModel originalModel) {
|
||||||
return new FluidTankModel(originalModel, AllSpriteShifts.FLUID_TANK, AllSpriteShifts.COPPER_CASING);
|
return new FluidTankModel(originalModel, AllSpriteShifts.FLUID_TANK, AllSpriteShifts.COPPER_CASING);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
public class BasinMovementBehaviour extends MovementBehaviour {
|
public class BasinMovementBehaviour implements MovementBehaviour {
|
||||||
public Map<String, ItemStackHandler> getOrReadInventory(MovementContext context) {
|
public Map<String, ItemStackHandler> getOrReadInventory(MovementContext context) {
|
||||||
Map<String, ItemStackHandler> map = new HashMap<>();
|
Map<String, ItemStackHandler> map = new HashMap<>();
|
||||||
map.put("InputItems", new ItemStackHandler(9));
|
map.put("InputItems", new ItemStackHandler(9));
|
||||||
|
@ -29,7 +29,7 @@ public class BasinMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(MovementContext context) {
|
public void tick(MovementContext context) {
|
||||||
super.tick(context);
|
MovementBehaviour.super.tick(context);
|
||||||
if (context.temporaryData == null || (boolean) context.temporaryData) {
|
if (context.temporaryData == null || (boolean) context.temporaryData) {
|
||||||
Vec3 facingVec = context.rotation.apply(Vec3.atLowerCornerOf(Direction.UP.getNormal()));
|
Vec3 facingVec = context.rotation.apply(Vec3.atLowerCornerOf(Direction.UP.getNormal()));
|
||||||
facingVec.normalize();
|
facingVec.normalize();
|
||||||
|
|
|
@ -56,7 +56,6 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
public class InWorldProcessing {
|
public class InWorldProcessing {
|
||||||
|
|
||||||
|
@ -473,9 +472,7 @@ public class InWorldProcessing {
|
||||||
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.SOUL)
|
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.SOUL)
|
||||||
.orElse(false))
|
.orElse(false))
|
||||||
return Type.HAUNTING;
|
return Type.HAUNTING;
|
||||||
if (block == Blocks.FIRE || ForgeRegistries.BLOCKS.getHolder(block)
|
if (block == Blocks.FIRE || blockState.is(BlockTags.CAMPFIRES)
|
||||||
.map(h -> h.containsTag(BlockTags.CAMPFIRES))
|
|
||||||
.orElse(false)
|
|
||||||
&& blockState.getOptionalValue(CampfireBlock.LIT)
|
&& blockState.getOptionalValue(CampfireBlock.LIT)
|
||||||
.orElse(false)
|
.orElse(false)
|
||||||
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
|
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
|
||||||
|
|
|
@ -82,7 +82,6 @@ import net.minecraftforge.client.IBlockRenderProperties;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEntity>, ISpecialBlockItemRequirement {
|
public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEntity>, ISpecialBlockItemRequirement {
|
||||||
|
|
||||||
|
@ -251,9 +250,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
boolean isWrench = AllItems.WRENCH.isIn(heldItem);
|
boolean isWrench = AllItems.WRENCH.isIn(heldItem);
|
||||||
boolean isConnector = AllItems.BELT_CONNECTOR.isIn(heldItem);
|
boolean isConnector = AllItems.BELT_CONNECTOR.isIn(heldItem);
|
||||||
boolean isShaft = AllBlocks.SHAFT.isIn(heldItem);
|
boolean isShaft = AllBlocks.SHAFT.isIn(heldItem);
|
||||||
boolean isDye = ForgeRegistries.ITEMS.getHolder(heldItem.getItem())
|
boolean isDye = heldItem.is(Tags.Items.DYES);
|
||||||
.map(h -> h.containsTag(Tags.Items.DYES))
|
|
||||||
.orElse(false);
|
|
||||||
boolean hasWater = EmptyingByBasin.emptyItem(world, heldItem, true)
|
boolean hasWater = EmptyingByBasin.emptyItem(world, heldItem, true)
|
||||||
.getFirst()
|
.getFirst()
|
||||||
.getFluid()
|
.getFluid()
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class BeltHelper {
|
||||||
|
|
||||||
public static boolean isItemUpright(ItemStack stack) {
|
public static boolean isItemUpright(ItemStack stack) {
|
||||||
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)
|
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)
|
||||||
.isPresent() || stack.is(AllItemTags.UPRIGHT_ON_BELT.tag);
|
.isPresent() || AllItemTags.UPRIGHT_ON_BELT.matches(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BeltTileEntity getSegmentTE(LevelAccessor world, BlockPos pos) {
|
public static BeltTileEntity getSegmentTE(LevelAccessor world, BlockPos pos) {
|
||||||
|
|
|
@ -11,12 +11,12 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.ParticleEngine;
|
import net.minecraft.client.particle.ParticleEngine;
|
||||||
import net.minecraft.client.particle.SpriteSet;
|
import net.minecraft.client.particle.SpriteSet;
|
||||||
import net.minecraft.core.Registry;
|
|
||||||
import net.minecraft.core.particles.ParticleOptions;
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
import net.minecraft.core.particles.ParticleType;
|
import net.minecraft.core.particles.ParticleType;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ -61,7 +61,7 @@ public abstract class BasicParticleData<T extends Particle> implements ParticleO
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String writeToString() {
|
public String writeToString() {
|
||||||
return Registry.PARTICLE_TYPE.getKey(getType()).toString();
|
return ForgeRegistries.PARTICLE_TYPES.getKey(getType()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.util.GsonHelper;
|
import net.minecraft.util.GsonHelper;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
@ -121,7 +122,7 @@ public class BlueprintItem extends Item {
|
||||||
filterItem.getOrCreateTag()
|
filterItem.getOrCreateTag()
|
||||||
.putInt("WhitelistMode", WhitelistMode.WHITELIST_DISJ.ordinal());
|
.putInt("WhitelistMode", WhitelistMode.WHITELIST_DISJ.ordinal());
|
||||||
ListTag attributes = new ListTag();
|
ListTag attributes = new ListTag();
|
||||||
ItemAttribute at = new ItemAttribute.InTag(resourcelocation);
|
ItemAttribute at = new ItemAttribute.InTag(ItemTags.create(resourcelocation));
|
||||||
CompoundTag compoundNBT = new CompoundTag();
|
CompoundTag compoundNBT = new CompoundTag();
|
||||||
at.serializeNBT(compoundNBT);
|
at.serializeNBT(compoundNBT);
|
||||||
compoundNBT.putBoolean("Inverted", false);
|
compoundNBT.putBoolean("Inverted", false);
|
||||||
|
|
|
@ -24,13 +24,11 @@ import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.tags.TagKey;
|
|
||||||
import net.minecraft.world.inventory.CraftingContainer;
|
import net.minecraft.world.inventory.CraftingContainer;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.phys.EntityHitResult;
|
import net.minecraft.world.phys.EntityHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
|
@ -40,6 +38,8 @@ import net.minecraftforge.client.gui.IIngameOverlay;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import net.minecraftforge.registries.tags.ITag;
|
||||||
|
import net.minecraftforge.registries.tags.ITagManager;
|
||||||
|
|
||||||
public class BlueprintOverlayRenderer {
|
public class BlueprintOverlayRenderer {
|
||||||
|
|
||||||
|
@ -278,17 +278,20 @@ public class BlueprintOverlayRenderer {
|
||||||
ListTag attributes = tag.getList("MatchedAttributes", net.minecraft.nbt.Tag.TAG_COMPOUND);
|
ListTag attributes = tag.getList("MatchedAttributes", net.minecraft.nbt.Tag.TAG_COMPOUND);
|
||||||
if (whitelistMode == WhitelistMode.WHITELIST_DISJ && attributes.size() == 1) {
|
if (whitelistMode == WhitelistMode.WHITELIST_DISJ && attributes.size() == 1) {
|
||||||
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
|
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
|
||||||
if (fromNBT instanceof ItemAttribute.InTag) {
|
if (fromNBT instanceof ItemAttribute.InTag inTag) {
|
||||||
ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT;
|
ITagManager<Item> tagManager = ForgeRegistries.ITEMS.tags();
|
||||||
TagKey<Item> itag = ForgeRegistries.ITEMS.tags()
|
if (tagManager.isKnownTagName(inTag.tag)) {
|
||||||
.getTagNames()
|
ITag<Item> taggedItems = tagManager.getTag(inTag.tag);
|
||||||
.filter(tk -> tk.location()
|
if (!taggedItems.isEmpty()) {
|
||||||
.equals(inTag.tagName))
|
ItemStack[] stacks = new ItemStack[taggedItems.size()];
|
||||||
.findAny()
|
int i = 0;
|
||||||
.orElse(null);
|
for (Item item : taggedItems) {
|
||||||
if (itag != null)
|
stacks[i] = new ItemStack(item);
|
||||||
return Ingredient.of(itag)
|
i++;
|
||||||
.getItems();
|
}
|
||||||
|
return stacks;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.foundation.mixin.accessor.FallingBlockEntityAccessor;
|
||||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -22,7 +23,6 @@ import net.minecraft.world.effect.MobEffect;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.animal.Fox;
|
import net.minecraft.world.entity.animal.Fox;
|
||||||
import net.minecraft.world.entity.item.FallingBlockEntity;
|
import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||||
|
@ -354,14 +354,10 @@ public class BuiltinPotatoProjectileTypes {
|
||||||
if (!world.isEmptyBlock(placePos.below()))
|
if (!world.isEmptyBlock(placePos.below()))
|
||||||
y = Math.max(y, placePos.getY());
|
y = Math.max(y, placePos.getY());
|
||||||
|
|
||||||
BlockState fallingState = block.get()
|
FallingBlockEntity falling = FallingBlockEntityAccessor.create$callInit(level, placePos.getX() + 0.5, y,
|
||||||
.defaultBlockState();
|
placePos.getZ() + 0.5, block.get().defaultBlockState());
|
||||||
|
falling.time = 1;
|
||||||
FallingBlockEntity fallingBlockEntity = new FallingBlockEntity(EntityType.FALLING_BLOCK, level);
|
world.addFreshEntity(falling);
|
||||||
fallingBlockEntity.setPos(placePos.getX() + 0.5, y, placePos.getZ() + 0.5);
|
|
||||||
fallingBlockEntity.time = 1;
|
|
||||||
fallingBlockEntity.blockState = fallingState;
|
|
||||||
world.addFreshEntity(fallingBlockEntity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
public class FunnelMovementBehaviour extends MovementBehaviour {
|
public class FunnelMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
private final boolean hasFilter;
|
private final boolean hasFilter;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class FunnelMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||||
super.visitNewPosition(context, pos);
|
MovementBehaviour.super.visitNewPosition(context, pos);
|
||||||
|
|
||||||
if (context.state.getValue(FunnelBlock.EXTRACTING))
|
if (context.state.getValue(FunnelBlock.EXTRACTING))
|
||||||
extract(context, pos);
|
extract(context, pos);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.ticks.TickPriority;
|
import net.minecraft.world.ticks.TickPriority;
|
||||||
|
|
||||||
public class ContactMovementBehaviour extends MovementBehaviour {
|
public class ContactMovementBehaviour implements MovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.simibubi.create.foundation.utility.Lang;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
|
@ -50,14 +51,13 @@ import net.minecraftforge.fml.ModList;
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
public interface ItemAttribute {
|
public interface ItemAttribute {
|
||||||
|
|
||||||
static List<ItemAttribute> types = new ArrayList<>();
|
static List<ItemAttribute> types = new ArrayList<>();
|
||||||
|
|
||||||
static ItemAttribute standard = register(StandardTraits.DUMMY);
|
static ItemAttribute standard = register(StandardTraits.DUMMY);
|
||||||
static ItemAttribute inTag = register(new InTag(new ResourceLocation("dummy")));
|
static ItemAttribute inTag = register(new InTag(ItemTags.LOGS));
|
||||||
static ItemAttribute inItemGroup = register(new InItemGroup(CreativeModeTab.TAB_MISC));
|
static ItemAttribute inItemGroup = register(new InItemGroup(CreativeModeTab.TAB_MISC));
|
||||||
static ItemAttribute addedBy = register(new InItemGroup.AddedBy("dummy"));
|
static ItemAttribute addedBy = register(new InItemGroup.AddedBy("dummy"));
|
||||||
static ItemAttribute hasEnchant = register(EnchantAttribute.EMPTY);
|
static ItemAttribute hasEnchant = register(EnchantAttribute.EMPTY);
|
||||||
|
@ -232,27 +232,20 @@ public interface ItemAttribute {
|
||||||
|
|
||||||
public static class InTag implements ItemAttribute {
|
public static class InTag implements ItemAttribute {
|
||||||
|
|
||||||
public ResourceLocation tagName;
|
public TagKey<Item> tag;
|
||||||
|
|
||||||
public InTag(ResourceLocation tagName) {
|
public InTag(TagKey<Item> tag) {
|
||||||
this.tagName = tagName;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean appliesTo(ItemStack stack) {
|
public boolean appliesTo(ItemStack stack) {
|
||||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
return stack.is(tag);
|
||||||
.get()
|
|
||||||
.tags()
|
|
||||||
.anyMatch(t -> t.location()
|
|
||||||
.equals(tagName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemAttribute> listAttributesOf(ItemStack stack) {
|
public List<ItemAttribute> listAttributesOf(ItemStack stack) {
|
||||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
return stack.getTags()
|
||||||
.get()
|
|
||||||
.tags()
|
|
||||||
.map(TagKey::location)
|
|
||||||
.map(InTag::new)
|
.map(InTag::new)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -264,18 +257,18 @@ public interface ItemAttribute {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getTranslationParameters() {
|
public Object[] getTranslationParameters() {
|
||||||
return new Object[] { "#" + tagName.toString() };
|
return new Object[] { "#" + tag.location() };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeNBT(CompoundTag nbt) {
|
public void writeNBT(CompoundTag nbt) {
|
||||||
nbt.putString("space", tagName.getNamespace());
|
nbt.putString("space", tag.location().getNamespace());
|
||||||
nbt.putString("path", tagName.getPath());
|
nbt.putString("path", tag.location().getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemAttribute readNBT(CompoundTag nbt) {
|
public ItemAttribute readNBT(CompoundTag nbt) {
|
||||||
return new InTag(new ResourceLocation(nbt.getString("space"), nbt.getString("path")));
|
return new InTag(ItemTags.create(new ResourceLocation(nbt.getString("space"), nbt.getString("path"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.content.palettes;
|
||||||
import static com.simibubi.create.content.palettes.PaletteBlockPattern.STANDARD_RANGE;
|
import static com.simibubi.create.content.palettes.PaletteBlockPattern.STANDARD_RANGE;
|
||||||
import static com.simibubi.create.content.palettes.PaletteBlockPattern.VANILLA_RANGE;
|
import static com.simibubi.create.content.palettes.PaletteBlockPattern.VANILLA_RANGE;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.simibubi.create.AllTags;
|
import com.simibubi.create.AllTags;
|
||||||
|
@ -82,8 +81,7 @@ public enum AllPaletteStoneTypes {
|
||||||
NonNullSupplier<Block> baseBlock = paletteStoneVariants.factory.apply(registrate);
|
NonNullSupplier<Block> baseBlock = paletteStoneVariants.factory.apply(registrate);
|
||||||
paletteStoneVariants.baseBlock = baseBlock;
|
paletteStoneVariants.baseBlock = baseBlock;
|
||||||
String id = Lang.asId(paletteStoneVariants.name());
|
String id = Lang.asId(paletteStoneVariants.name());
|
||||||
paletteStoneVariants.materialTag = AllTags.tag(r -> ForgeRegistries.ITEMS.tags()
|
paletteStoneVariants.materialTag = AllTags.optionalTag(ForgeRegistries.ITEMS, Create.asResource("stone_types/" + id));
|
||||||
.createOptionalTagKey(r, Collections.emptySet()), Create.ID, "stone_types/" + id);
|
|
||||||
paletteStoneVariants.variants = new PalettesVariantEntry(id, paletteStoneVariants);
|
paletteStoneVariants.variants = new PalettesVariantEntry(id, paletteStoneVariants);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.FluidTags;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.util.GsonHelper;
|
import net.minecraft.util.GsonHelper;
|
||||||
import net.minecraft.world.level.material.FlowingFluid;
|
import net.minecraft.world.level.material.FlowingFluid;
|
||||||
|
@ -200,6 +200,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
||||||
|
|
||||||
protected TagKey<Fluid> tag;
|
protected TagKey<Fluid> tag;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
protected boolean testInternal(FluidStack t) {
|
protected boolean testInternal(FluidStack t) {
|
||||||
if (tag == null)
|
if (tag == null)
|
||||||
|
@ -207,9 +208,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
||||||
if (accepted.getFluid()
|
if (accepted.getFluid()
|
||||||
.isSame(t.getFluid()))
|
.isSame(t.getFluid()))
|
||||||
return true;
|
return true;
|
||||||
return ForgeRegistries.FLUIDS.getHolder(t.getFluid())
|
return t.getFluid().is(tag);
|
||||||
.map(h -> h.containsTag(tag))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -231,8 +230,8 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readInternal(JsonObject json) {
|
protected void readInternal(JsonObject json) {
|
||||||
ResourceLocation resourcelocation = new ResourceLocation(GsonHelper.getAsString(json, "fluidTag"));
|
ResourceLocation name = new ResourceLocation(GsonHelper.getAsString(json, "fluidTag"));
|
||||||
tag = TagKey.create(Registry.FLUID_REGISTRY, resourcelocation);
|
tag = FluidTags.create(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,11 +24,8 @@ public class TagDependentIngredientItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldHide() {
|
public boolean shouldHide() {
|
||||||
ITagManager<Item> tags = ForgeRegistries.ITEMS.tags();
|
ITagManager<Item> tagManager = ForgeRegistries.ITEMS.tags();
|
||||||
if (tags == null || !tags.isKnownTagName(tag))
|
return !tagManager.isKnownTagName(tag) || tagManager.getTag(tag).isEmpty();
|
||||||
return false;
|
|
||||||
return tags.getTag(tag)
|
|
||||||
.isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.simibubi.create.foundation.mixin.accessor;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
@Mixin(FallingBlockEntity.class)
|
||||||
|
public interface FallingBlockEntityAccessor {
|
||||||
|
@Invoker("<init>")
|
||||||
|
static FallingBlockEntity create$callInit(Level level, double x, double y, double z, BlockState state) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,6 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.FenceBlock;
|
import net.minecraft.world.level.block.FenceBlock;
|
||||||
import net.minecraftforge.client.model.ItemMultiLayerBakedModel;
|
import net.minecraftforge.client.model.ItemMultiLayerBakedModel;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
public class ValueBoxRenderer {
|
public class ValueBoxRenderer {
|
||||||
|
|
||||||
|
@ -34,22 +33,21 @@ public class ValueBoxRenderer {
|
||||||
itemRenderer.renderStatic(filter, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
itemRenderer.renderStatic(filter, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private static float customZOffset(Item item) {
|
private static float customZOffset(Item item) {
|
||||||
float NUDGE = -.1f;
|
float nudge = -.1f;
|
||||||
if (item instanceof FilterItem)
|
if (item instanceof FilterItem)
|
||||||
return NUDGE;
|
return nudge;
|
||||||
if (item instanceof BlockItem) {
|
if (item instanceof BlockItem) {
|
||||||
Block block = ((BlockItem) item).getBlock();
|
Block block = ((BlockItem) item).getBlock();
|
||||||
if (block instanceof AbstractShaftBlock)
|
if (block instanceof AbstractShaftBlock)
|
||||||
return NUDGE;
|
return nudge;
|
||||||
if (block instanceof FenceBlock)
|
if (block instanceof FenceBlock)
|
||||||
return NUDGE;
|
return nudge;
|
||||||
if (ForgeRegistries.BLOCKS.getHolder(block)
|
if (block.builtInRegistryHolder().is(BlockTags.BUTTONS))
|
||||||
.map(h -> h.containsTag(BlockTags.BUTTONS))
|
return nudge;
|
||||||
.orElse(false))
|
|
||||||
return NUDGE;
|
|
||||||
if (block == Blocks.END_ROD)
|
if (block == Blocks.END_ROD)
|
||||||
return NUDGE;
|
return nudge;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class DirectBeltInputBehaviour extends TileEntityBehaviour {
|
||||||
return ItemHandlerHelper.insertItemStacked(lazy.orElse(null), inserted.stack.copy(), simulate);
|
return ItemHandlerHelper.insertItemStacked(lazy.orElse(null), inserted.stack.copy(), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: verify that this side is consistent across all calls
|
||||||
public boolean canInsertFromSide(Direction side) {
|
public boolean canInsertFromSide(Direction side) {
|
||||||
return canInsert.test(side);
|
return canInsert.test(side);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ protected net.minecraft.client.particle.Particle f_107205_ # stoppedByCollision
|
||||||
public net.minecraft.client.renderer.ItemInHandRenderer f_109300_ # mainHandItem
|
public net.minecraft.client.renderer.ItemInHandRenderer f_109300_ # mainHandItem
|
||||||
public net.minecraft.client.renderer.ItemInHandRenderer f_109301_ # offHandItem
|
public net.minecraft.client.renderer.ItemInHandRenderer f_109301_ # offHandItem
|
||||||
public net.minecraft.client.renderer.entity.ItemRenderer f_115096_ # textureManager
|
public net.minecraft.client.renderer.entity.ItemRenderer f_115096_ # textureManager
|
||||||
public net.minecraft.world.entity.item.FallingBlockEntity f_31946_ # blockState
|
|
||||||
|
|
||||||
public-f net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket f_132663_ # flyingSpeed
|
public-f net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket f_132663_ # flyingSpeed
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
modLoader="javafml"
|
modLoader="javafml"
|
||||||
loaderVersion="[38,)"
|
loaderVersion="[40,)"
|
||||||
issueTrackerURL="https://github.com/Creators-of-Create/Create/issues"
|
issueTrackerURL="https://github.com/Creators-of-Create/Create/issues"
|
||||||
license="MIT"
|
license="MIT"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ uniform vec4 ColorModulator;
|
||||||
uniform float FogStart;
|
uniform float FogStart;
|
||||||
uniform float FogEnd;
|
uniform float FogEnd;
|
||||||
uniform vec4 FogColor;
|
uniform vec4 FogColor;
|
||||||
uniform float GameTime;
|
|
||||||
|
|
||||||
in float vertexDistance;
|
in float vertexDistance;
|
||||||
in vec4 vertexColor;
|
in vec4 vertexColor;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
|
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
|
||||||
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
|
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
|
||||||
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
|
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
|
||||||
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
|
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
|
||||||
|
{ "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ uniform sampler2D Sampler2;
|
||||||
uniform mat4 ModelViewMat;
|
uniform mat4 ModelViewMat;
|
||||||
uniform mat4 ProjMat;
|
uniform mat4 ProjMat;
|
||||||
uniform mat3 IViewRotMat;
|
uniform mat3 IViewRotMat;
|
||||||
|
uniform int FogShape;
|
||||||
|
|
||||||
out float vertexDistance;
|
out float vertexDistance;
|
||||||
out vec4 vertexColor;
|
out vec4 vertexColor;
|
||||||
|
@ -26,7 +27,7 @@ out vec4 normal;
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
||||||
|
|
||||||
vertexDistance = cylindrical_distance(ModelViewMat, IViewRotMat * Position);
|
vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
|
||||||
vertexColor = Color;
|
vertexColor = Color;
|
||||||
lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
|
lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
|
||||||
texCoord0 = UV0;
|
texCoord0 = UV0;
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"CustomItemUseEffectsMixin",
|
"CustomItemUseEffectsMixin",
|
||||||
"accessor.AbstractProjectileDispenseBehaviorAccessor",
|
"accessor.AbstractProjectileDispenseBehaviorAccessor",
|
||||||
"accessor.LivingEntityAccessor",
|
"accessor.DispenserBlockAccessor",
|
||||||
"accessor.DispenserBlockAccessor"
|
"accessor.FallingBlockEntityAccessor",
|
||||||
|
"accessor.LivingEntityAccessor"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"DestroyProgressMixin",
|
"DestroyProgressMixin",
|
||||||
|
|
Loading…
Reference in a new issue