mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-30 14:55:01 +01:00
Merge remote-tracking branch 'origin/mc1.16/dev' into mc1.16/chromatic-projector
This commit is contained in:
commit
7f9ff3b7ca
128 changed files with 1085 additions and 899 deletions
|
@ -9,8 +9,6 @@ import static com.simibubi.create.foundation.data.CreateRegistrate.connectedText
|
||||||
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
|
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
|
||||||
import static com.simibubi.create.foundation.data.ModelGen.oxidizedItemModel;
|
import static com.simibubi.create.foundation.data.ModelGen.oxidizedItemModel;
|
||||||
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
import com.simibubi.create.AllTags.AllItemTags;
|
import com.simibubi.create.AllTags.AllItemTags;
|
||||||
import com.simibubi.create.content.AllSections;
|
import com.simibubi.create.content.AllSections;
|
||||||
|
@ -204,7 +202,7 @@ import net.minecraftforge.common.ToolType;
|
||||||
public class AllBlocks {
|
public class AllBlocks {
|
||||||
|
|
||||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||||
.itemGroup(() -> Create.baseCreativeTab);
|
.itemGroup(() -> Create.BASE_CREATIVE_TAB);
|
||||||
|
|
||||||
// Schematics
|
// Schematics
|
||||||
|
|
||||||
|
@ -618,32 +616,31 @@ public class AllBlocks {
|
||||||
.blockstate((c, p) -> BlockStateGen.directionalAxisBlock(c, p,
|
.blockstate((c, p) -> BlockStateGen.directionalAxisBlock(c, p,
|
||||||
(state, vertical) -> AssetLookup.partialBaseModel(c, p, vertical ? "vertical" : "horizontal",
|
(state, vertical) -> AssetLookup.partialBaseModel(c, p, vertical ? "vertical" : "horizontal",
|
||||||
state.get(FluidValveBlock.ENABLED) ? "open" : "closed")))
|
state.get(FluidValveBlock.ENABLED) ? "open" : "closed")))
|
||||||
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
|
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
|
||||||
|
|
||||||
public static final BlockEntry<ValveHandleBlock> COPPER_VALVE_HANDLE =
|
|
||||||
REGISTRATE.block("copper_valve_handle", ValveHandleBlock::copper)
|
|
||||||
.transform(BuilderTransformers.valveHandle(null))
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final Vector<BlockEntry<ValveHandleBlock>> DYED_VALVE_HANDLES =
|
public static final BlockEntry<ValveHandleBlock> COPPER_VALVE_HANDLE =
|
||||||
new Vector<>(DyeColor.values().length);
|
REGISTRATE.block("copper_valve_handle", ValveHandleBlock::copper)
|
||||||
|
.transform(BuilderTransformers.valveHandle(null))
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final BlockEntry<?>[] DYED_VALVE_HANDLES = new BlockEntry<?>[DyeColor.values().length];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (DyeColor colour : DyeColor.values()) {
|
for (DyeColor colour : DyeColor.values()) {
|
||||||
String colourName = colour.getString();
|
String colourName = colour.getString();
|
||||||
DYED_VALVE_HANDLES.add(REGISTRATE.block(colourName + "_valve_handle", ValveHandleBlock::dyed)
|
DYED_VALVE_HANDLES[colour.ordinal()] = REGISTRATE.block(colourName + "_valve_handle", ValveHandleBlock::dyed)
|
||||||
.transform(BuilderTransformers.valveHandle(colour))
|
.transform(BuilderTransformers.valveHandle(colour))
|
||||||
.recipe((c, p) -> ShapedRecipeBuilder.shapedRecipe(c.get())
|
.recipe((c, p) -> ShapedRecipeBuilder.shapedRecipe(c.get())
|
||||||
.patternLine("#")
|
.patternLine("#")
|
||||||
.patternLine("-")
|
.patternLine("-")
|
||||||
.key('#', DyeHelper.getTagOfDye(colour))
|
.key('#', DyeHelper.getTagOfDye(colour))
|
||||||
.key('-', AllItemTags.VALVE_HANDLES.tag)
|
.key('-', AllItemTags.VALVE_HANDLES.tag)
|
||||||
.addCriterion("has_valve", RegistrateRecipeProvider.hasItem(AllItemTags.VALVE_HANDLES.tag))
|
.addCriterion("has_valve", RegistrateRecipeProvider.hasItem(AllItemTags.VALVE_HANDLES.tag))
|
||||||
.build(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_valve_handle")))
|
.build(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_valve_handle")))
|
||||||
.register());
|
.register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,46 +3,38 @@ package com.simibubi.create;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.block.IBlockVertexColor;
|
|
||||||
import com.simibubi.create.foundation.block.render.ColoredVertexModel;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.RedstoneWireBlock;
|
import net.minecraft.block.RedstoneWireBlock;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.color.BlockColors;
|
import net.minecraft.client.renderer.color.BlockColors;
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
import net.minecraft.client.renderer.color.IBlockColor;
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.client.renderer.color.ItemColors;
|
import net.minecraft.client.renderer.color.ItemColors;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.util.IItemProvider;
|
import net.minecraft.util.IItemProvider;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.GrassColors;
|
import net.minecraft.world.GrassColors;
|
||||||
import net.minecraft.world.IBlockDisplayReader;
|
|
||||||
import net.minecraft.world.biome.BiomeColors;
|
import net.minecraft.world.biome.BiomeColors;
|
||||||
|
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class AllColorHandlers {
|
public class AllColorHandlers {
|
||||||
|
|
||||||
private final Map<Block, IBlockVertexColor> coloredVertexBlocks = new HashMap<>();
|
|
||||||
private final Map<Block, IBlockColor> coloredBlocks = new HashMap<>();
|
private final Map<Block, IBlockColor> coloredBlocks = new HashMap<>();
|
||||||
private final Map<IItemProvider, IItemColor> coloredItems = new HashMap<>();
|
private final Map<IItemProvider, IItemColor> coloredItems = new HashMap<>();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
public static IBlockColor getGrassyBlock() {
|
public static IBlockColor getGrassyBlock() {
|
||||||
return new BlockColor(
|
return (state, world, pos, layer) -> pos != null && world != null ? BiomeColors.getGrassColor(world, pos)
|
||||||
(state, world, pos, layer) -> pos != null && world != null ? BiomeColors.getGrassColor(world, pos)
|
: GrassColors.get(0.5D, 1.0D);
|
||||||
: GrassColors.get(0.5D, 1.0D));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IItemColor getGrassyItem() {
|
public static IItemColor getGrassyItem() {
|
||||||
return new ItemColor((stack, layer) -> GrassColors.get(0.5D, 1.0D));
|
return (stack, layer) -> GrassColors.get(0.5D, 1.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBlockColor getRedstonePower() {
|
public static IBlockColor getRedstonePower() {
|
||||||
return new BlockColor((state, world, pos, layer) -> RedstoneWireBlock
|
return (state, world, pos, layer) -> RedstoneWireBlock
|
||||||
.getWireColor(pos != null && world != null ? state.get(BlockStateProperties.POWER_0_15) : 0));
|
.getWireColor(pos != null && world != null ? state.get(BlockStateProperties.POWER_0_15) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -51,66 +43,22 @@ public class AllColorHandlers {
|
||||||
coloredBlocks.put(block, color);
|
coloredBlocks.put(block, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(Block block, IBlockVertexColor color) {
|
|
||||||
coloredVertexBlocks.put(block, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(IItemProvider item, IItemColor color) {
|
public void register(IItemProvider item, IItemColor color) {
|
||||||
coloredItems.put(item, color);
|
coloredItems.put(item, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
|
||||||
BlockColors blockColors = Minecraft.getInstance()
|
|
||||||
.getBlockColors();
|
|
||||||
ItemColors itemColors = Minecraft.getInstance()
|
|
||||||
.getItemColors();
|
|
||||||
|
|
||||||
coloredBlocks.forEach((block, color) -> blockColors.register(color, block));
|
|
||||||
coloredItems.forEach((item, color) -> itemColors.register(color, item));
|
|
||||||
coloredVertexBlocks.forEach((block, color) -> CreateClient.getCustomBlockModels()
|
|
||||||
.register(() -> block, model -> new ColoredVertexModel(model, color)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
private static class ItemColor implements IItemColor {
|
@SubscribeEvent
|
||||||
|
public void registerBlockColors(ColorHandlerEvent.Block event) {
|
||||||
private Function function;
|
BlockColors blockColors = event.getBlockColors();
|
||||||
|
coloredBlocks.forEach((block, color) -> blockColors.register(color, block));
|
||||||
@FunctionalInterface
|
|
||||||
interface Function {
|
|
||||||
int apply(ItemStack stack, int layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemColor(Function function) {
|
|
||||||
this.function = function;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getColor(ItemStack stack, int layer) {
|
|
||||||
return function.apply(stack, layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BlockColor implements IBlockColor {
|
@SubscribeEvent
|
||||||
|
public void registerItemColors(ColorHandlerEvent.Item event) {
|
||||||
private Function function;
|
ItemColors itemColors = event.getItemColors();
|
||||||
|
coloredItems.forEach((item, color) -> itemColors.register(color, item));
|
||||||
@FunctionalInterface
|
|
||||||
interface Function {
|
|
||||||
int apply(BlockState state, IBlockDisplayReader world, BlockPos pos, int layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockColor(Function function) {
|
|
||||||
this.function = function;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getColor(BlockState state, IBlockDisplayReader world, BlockPos pos, int layer) {
|
|
||||||
return function.apply(state, world, pos, layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,61 +10,37 @@ import com.simibubi.create.content.schematics.block.SchematicTableContainer;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicTableScreen;
|
import com.simibubi.create.content.schematics.block.SchematicTableScreen;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonContainer;
|
import com.simibubi.create.content.schematics.block.SchematicannonContainer;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonScreen;
|
import com.simibubi.create.content.schematics.block.SchematicannonScreen;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.tterrag.registrate.builders.ContainerBuilder.ForgeContainerFactory;
|
||||||
|
import com.tterrag.registrate.builders.ContainerBuilder.ScreenFactory;
|
||||||
|
import com.tterrag.registrate.util.entry.ContainerEntry;
|
||||||
|
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||||
|
|
||||||
import net.minecraft.client.gui.IHasContainer;
|
import net.minecraft.client.gui.IHasContainer;
|
||||||
import net.minecraft.client.gui.ScreenManager;
|
|
||||||
import net.minecraft.client.gui.ScreenManager.IScreenFactory;
|
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.inventory.container.ContainerType;
|
|
||||||
import net.minecraft.inventory.container.ContainerType.IFactory;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
|
||||||
import net.minecraftforge.fml.network.IContainerFactory;
|
|
||||||
|
|
||||||
public enum AllContainerTypes {
|
public class AllContainerTypes {
|
||||||
|
|
||||||
SCHEMATIC_TABLE(SchematicTableContainer::new),
|
public static final ContainerEntry<SchematicTableContainer> SCHEMATIC_TABLE =
|
||||||
SCHEMATICANNON(SchematicannonContainer::new),
|
register("schematic_table", SchematicTableContainer::new, () -> SchematicTableScreen::new);
|
||||||
FLEXCRATE(AdjustableCrateContainer::new),
|
|
||||||
FILTER(FilterContainer::new),
|
|
||||||
ATTRIBUTE_FILTER(AttributeFilterContainer::new),
|
|
||||||
|
|
||||||
;
|
public static final ContainerEntry<SchematicannonContainer> SCHEMATICANNON =
|
||||||
|
register("schematicannon", SchematicannonContainer::new, () -> SchematicannonScreen::new);
|
||||||
|
|
||||||
public ContainerType<? extends Container> type;
|
public static final ContainerEntry<AdjustableCrateContainer> FLEXCRATE =
|
||||||
private IFactory<?> factory;
|
register("flexcrate", AdjustableCrateContainer::new, () -> AdjustableCrateScreen::new);
|
||||||
|
|
||||||
private <C extends Container> AllContainerTypes(IContainerFactory<C> factory) {
|
public static final ContainerEntry<FilterContainer> FILTER =
|
||||||
this.factory = factory;
|
register("filter", FilterContainer::new, () -> FilterScreen::new);
|
||||||
|
|
||||||
|
public static final ContainerEntry<AttributeFilterContainer> ATTRIBUTE_FILTER =
|
||||||
|
register("attribute_filter", AttributeFilterContainer::new, () -> AttributeFilterScreen::new);
|
||||||
|
|
||||||
|
private static <C extends Container, S extends Screen & IHasContainer<C>> ContainerEntry<C> register(String name, ForgeContainerFactory<C> factory, NonNullSupplier<ScreenFactory<C, S>> screenFactory) {
|
||||||
|
return Create.registrate().container(name, factory, screenFactory).register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(RegistryEvent.Register<ContainerType<?>> event) {
|
public static void register() {
|
||||||
for (AllContainerTypes container : values()) {
|
|
||||||
container.type = new ContainerType<>(container.factory)
|
|
||||||
.setRegistryName(new ResourceLocation(Create.ID, Lang.asId(container.name())));
|
|
||||||
event.getRegistry()
|
|
||||||
.register(container.type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public static void registerScreenFactories() {
|
|
||||||
bind(SCHEMATIC_TABLE, SchematicTableScreen::new);
|
|
||||||
bind(SCHEMATICANNON, SchematicannonScreen::new);
|
|
||||||
bind(FLEXCRATE, AdjustableCrateScreen::new);
|
|
||||||
bind(FILTER, FilterScreen::new);
|
|
||||||
bind(ATTRIBUTE_FILTER, AttributeFilterScreen::new);
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static <C extends Container, S extends Screen & IHasContainer<C>> void bind(AllContainerTypes c,
|
|
||||||
IScreenFactory<C, S> factory) {
|
|
||||||
ScreenManager.registerFactory((ContainerType<C>) c.type, factory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,65 +10,63 @@ import com.simibubi.create.content.contraptions.components.structureMovement.gan
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueRenderer;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
import com.tterrag.registrate.util.entry.EntityEntry;
|
||||||
import com.tterrag.registrate.util.nullness.NonNullConsumer;
|
import com.tterrag.registrate.util.nullness.NonNullConsumer;
|
||||||
|
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityClassification;
|
import net.minecraft.entity.EntityClassification;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.EntityType.IFactory;
|
import net.minecraft.entity.EntityType.IFactory;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|
||||||
|
|
||||||
public class AllEntityTypes {
|
public class AllEntityTypes {
|
||||||
|
|
||||||
public static final RegistryEntry<EntityType<OrientedContraptionEntity>> ORIENTED_CONTRAPTION =
|
public static final EntityEntry<OrientedContraptionEntity> ORIENTED_CONTRAPTION =
|
||||||
contraption("contraption", OrientedContraptionEntity::new, 5, 3, true);
|
contraption("contraption", OrientedContraptionEntity::new, () -> OrientedContraptionEntityRenderer::new,
|
||||||
public static final RegistryEntry<EntityType<ControlledContraptionEntity>> CONTROLLED_CONTRAPTION =
|
5, 3, true);
|
||||||
contraption("stationary_contraption", ControlledContraptionEntity::new, 20, 40, false);
|
public static final EntityEntry<ControlledContraptionEntity> CONTROLLED_CONTRAPTION =
|
||||||
public static final RegistryEntry<EntityType<GantryContraptionEntity>> GANTRY_CONTRAPTION =
|
contraption("stationary_contraption", ControlledContraptionEntity::new, () -> ContraptionEntityRenderer::new,
|
||||||
contraption("gantry_contraption", GantryContraptionEntity::new, 10, 40, false);
|
20, 40, false);
|
||||||
|
public static final EntityEntry<GantryContraptionEntity> GANTRY_CONTRAPTION =
|
||||||
|
contraption("gantry_contraption", GantryContraptionEntity::new, () -> ContraptionEntityRenderer::new,
|
||||||
|
10, 40, false);
|
||||||
|
|
||||||
public static final RegistryEntry<EntityType<SuperGlueEntity>> SUPER_GLUE = register("super_glue",
|
public static final EntityEntry<SuperGlueEntity> SUPER_GLUE =
|
||||||
SuperGlueEntity::new, EntityClassification.MISC, 10, Integer.MAX_VALUE, false, true, SuperGlueEntity::build);
|
register("super_glue", SuperGlueEntity::new, () -> SuperGlueRenderer::new,
|
||||||
public static final RegistryEntry<EntityType<SeatEntity>> SEAT = register("seat", SeatEntity::new,
|
EntityClassification.MISC, 10, Integer.MAX_VALUE, false, true, SuperGlueEntity::build);
|
||||||
EntityClassification.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build);
|
public static final EntityEntry<SeatEntity> SEAT =
|
||||||
|
register("seat", SeatEntity::new, () -> SeatEntity.Render::new,
|
||||||
|
EntityClassification.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
public static void register() {}
|
private static <T extends Entity> EntityEntry<T> contraption(String name, IFactory<T> factory,
|
||||||
|
NonNullSupplier<IRenderFactory<? super T>> renderer, int range, int updateFrequency,
|
||||||
private static <T extends Entity> RegistryEntry<EntityType<T>> contraption(String name, IFactory<T> factory,
|
boolean sendVelocity) {
|
||||||
int range, int updateFrequency, boolean sendVelocity) {
|
return register(name, factory, renderer, EntityClassification.MISC, range, updateFrequency,
|
||||||
return register(name, factory, EntityClassification.MISC, range, updateFrequency, sendVelocity, true,
|
sendVelocity, true, AbstractContraptionEntity::build);
|
||||||
AbstractContraptionEntity::build);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Entity> RegistryEntry<EntityType<T>> register(String name, IFactory<T> factory,
|
private static <T extends Entity> EntityEntry<T> register(String name, IFactory<T> factory,
|
||||||
EntityClassification group, int range, int updateFrequency, boolean sendVelocity, boolean immuneToFire,
|
NonNullSupplier<IRenderFactory<? super T>> renderer, EntityClassification group, int range,
|
||||||
NonNullConsumer<EntityType.Builder<T>> propertyBuilder) {
|
int updateFrequency, boolean sendVelocity, boolean immuneToFire,
|
||||||
|
NonNullConsumer<EntityType.Builder<T>> propertyBuilder) {
|
||||||
String id = Lang.asId(name);
|
String id = Lang.asId(name);
|
||||||
return Create.registrate()
|
return Create.registrate()
|
||||||
.entity(id, factory, group)
|
.entity(id, factory, group)
|
||||||
.properties(b -> b.setTrackingRange(range)
|
.properties(b -> b.setTrackingRange(range)
|
||||||
.setUpdateInterval(updateFrequency)
|
.setUpdateInterval(updateFrequency)
|
||||||
.setShouldReceiveVelocityUpdates(sendVelocity))
|
.setShouldReceiveVelocityUpdates(sendVelocity))
|
||||||
.properties(propertyBuilder)
|
.properties(propertyBuilder)
|
||||||
.properties(b -> {
|
.properties(b -> {
|
||||||
if (immuneToFire)
|
if (immuneToFire)
|
||||||
b.immuneToFire();
|
b.immuneToFire();
|
||||||
})
|
})
|
||||||
.register();
|
.renderer(renderer)
|
||||||
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(value = Dist.CLIENT)
|
public static void register() {
|
||||||
public static void registerRenderers() {
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(CONTROLLED_CONTRAPTION.get(), ContraptionEntityRenderer::new);
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(ORIENTED_CONTRAPTION.get(),
|
|
||||||
OrientedContraptionEntityRenderer::new);
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(GANTRY_CONTRAPTION.get(), ContraptionEntityRenderer::new);
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(SUPER_GLUE.get(), SuperGlueRenderer::new);
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(SEAT.get(), SeatEntity.Render::new);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid;
|
||||||
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid.PotionFluidAttributes;
|
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid.PotionFluidAttributes;
|
||||||
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
||||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
import com.tterrag.registrate.util.entry.FluidEntry;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
@ -25,47 +25,47 @@ public class AllFluids {
|
||||||
|
|
||||||
private static final CreateRegistrate REGISTRATE = Create.registrate();
|
private static final CreateRegistrate REGISTRATE = Create.registrate();
|
||||||
|
|
||||||
public static RegistryEntry<PotionFluid> POTION =
|
public static FluidEntry<PotionFluid> POTION =
|
||||||
REGISTRATE.virtualFluid("potion", PotionFluidAttributes::new, PotionFluid::new)
|
REGISTRATE.virtualFluid("potion", PotionFluidAttributes::new, PotionFluid::new)
|
||||||
.lang(f -> "fluid.create.potion", "Potion")
|
.lang(f -> "fluid.create.potion", "Potion")
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static FluidEntry<VirtualFluid> TEA = REGISTRATE.virtualFluid("tea")
|
||||||
|
.lang(f -> "fluid.create.tea", "Builder's Tea")
|
||||||
|
.tag(AllTags.forgeFluidTag("tea"))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static RegistryEntry<VirtualFluid> TEA = REGISTRATE.virtualFluid("tea")
|
public static FluidEntry<VirtualFluid> MILK = REGISTRATE.virtualFluid("milk")
|
||||||
.lang(f -> "fluid.create.tea", "Builder's Tea")
|
.lang(f -> "fluid.create.milk", "Milk")
|
||||||
.tag(AllTags.forgeFluidTag("tea"))
|
.tag(AllTags.forgeFluidTag("milk"))
|
||||||
.register();
|
|
||||||
|
|
||||||
public static RegistryEntry<VirtualFluid> MILK = REGISTRATE.virtualFluid("milk")
|
|
||||||
.lang(f -> "fluid.create.milk", "Milk")
|
|
||||||
.tag(AllTags.forgeFluidTag("milk"))
|
|
||||||
.register();
|
|
||||||
|
|
||||||
public static RegistryEntry<ForgeFlowingFluid.Flowing> HONEY =
|
|
||||||
REGISTRATE.standardFluid("honey", NoColorFluidAttributes::new)
|
|
||||||
.lang(f -> "fluid.create.honey", "Honey")
|
|
||||||
.attributes(b -> b.viscosity(500)
|
|
||||||
.density(1400))
|
|
||||||
.properties(p -> p.levelDecreasePerBlock(2)
|
|
||||||
.tickRate(25)
|
|
||||||
.slopeFindDistance(3)
|
|
||||||
.explosionResistance(100f))
|
|
||||||
.tag(AllTags.forgeFluidTag("honey"))
|
|
||||||
.bucket()
|
|
||||||
.properties(p -> p.maxStackSize(1))
|
|
||||||
.build()
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static RegistryEntry<ForgeFlowingFluid.Flowing> CHOCOLATE =
|
public static FluidEntry<ForgeFlowingFluid.Flowing> HONEY =
|
||||||
REGISTRATE.standardFluid("chocolate", NoColorFluidAttributes::new)
|
REGISTRATE.standardFluid("honey", NoColorFluidAttributes::new)
|
||||||
.lang(f -> "fluid.create.chocolate", "Chocolate")
|
.lang(f -> "fluid.create.honey", "Honey")
|
||||||
.tag(AllTags.forgeFluidTag("chocolate"))
|
.attributes(b -> b.viscosity(500)
|
||||||
.attributes(b -> b.viscosity(500)
|
.density(1400))
|
||||||
.density(1400))
|
.properties(p -> p.levelDecreasePerBlock(2)
|
||||||
.properties(p -> p.levelDecreasePerBlock(2)
|
.tickRate(25)
|
||||||
.tickRate(25)
|
.slopeFindDistance(3)
|
||||||
.slopeFindDistance(3)
|
.explosionResistance(100f))
|
||||||
.explosionResistance(100f))
|
.tag(AllTags.forgeFluidTag("honey"))
|
||||||
.bucket()
|
.bucket()
|
||||||
|
.properties(p -> p.maxStackSize(1))
|
||||||
|
.build()
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static FluidEntry<ForgeFlowingFluid.Flowing> CHOCOLATE =
|
||||||
|
REGISTRATE.standardFluid("chocolate", NoColorFluidAttributes::new)
|
||||||
|
.lang(f -> "fluid.create.chocolate", "Chocolate")
|
||||||
|
.tag(AllTags.forgeFluidTag("chocolate"))
|
||||||
|
.attributes(b -> b.viscosity(500)
|
||||||
|
.density(1400))
|
||||||
|
.properties(p -> p.levelDecreasePerBlock(2)
|
||||||
|
.tickRate(25)
|
||||||
|
.slopeFindDistance(3)
|
||||||
|
.explosionResistance(100f))
|
||||||
|
.bucket()
|
||||||
.properties(p -> p.maxStackSize(1))
|
.properties(p -> p.maxStackSize(1))
|
||||||
.build()
|
.build()
|
||||||
.register();
|
.register();
|
||||||
|
@ -78,7 +78,7 @@ public class AllFluids {
|
||||||
public static void assignRenderLayers() {}
|
public static void assignRenderLayers() {}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private static void makeTranslucent(RegistryEntry<? extends ForgeFlowingFluid> entry) {
|
private static void makeTranslucent(FluidEntry<?> entry) {
|
||||||
ForgeFlowingFluid fluid = entry.get();
|
ForgeFlowingFluid fluid = entry.get();
|
||||||
RenderTypeLookup.setRenderLayer(fluid, RenderType.getTranslucent());
|
RenderTypeLookup.setRenderLayer(fluid, RenderType.getTranslucent());
|
||||||
RenderTypeLookup.setRenderLayer(fluid.getStillFluid(), RenderType.getTranslucent());
|
RenderTypeLookup.setRenderLayer(fluid.getStillFluid(), RenderType.getTranslucent());
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
import static com.simibubi.create.AllTags.forgeItemTag;
|
|
||||||
import static com.simibubi.create.AllTags.AllItemTags.CREATE_INGOTS;
|
import static com.simibubi.create.AllTags.AllItemTags.CREATE_INGOTS;
|
||||||
import static com.simibubi.create.AllTags.AllItemTags.CRUSHED_ORES;
|
import static com.simibubi.create.AllTags.AllItemTags.CRUSHED_ORES;
|
||||||
import static com.simibubi.create.AllTags.AllItemTags.NUGGETS;
|
import static com.simibubi.create.AllTags.AllItemTags.NUGGETS;
|
||||||
import static com.simibubi.create.AllTags.AllItemTags.PLATES;
|
import static com.simibubi.create.AllTags.AllItemTags.PLATES;
|
||||||
|
import static com.simibubi.create.AllTags.forgeItemTag;
|
||||||
import static com.simibubi.create.content.AllSections.CURIOSITIES;
|
import static com.simibubi.create.content.AllSections.CURIOSITIES;
|
||||||
import static com.simibubi.create.content.AllSections.KINETICS;
|
import static com.simibubi.create.content.AllSections.KINETICS;
|
||||||
import static com.simibubi.create.content.AllSections.LOGISTICS;
|
import static com.simibubi.create.content.AllSections.LOGISTICS;
|
||||||
|
@ -61,7 +61,7 @@ import net.minecraft.util.ResourceLocation;
|
||||||
public class AllItems {
|
public class AllItems {
|
||||||
|
|
||||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||||
.itemGroup(() -> Create.baseCreativeTab);
|
.itemGroup(() -> Create.BASE_CREATIVE_TAB);
|
||||||
|
|
||||||
// Schematics
|
// Schematics
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
|
|
||||||
public enum AllKeys {
|
public enum AllKeys {
|
||||||
|
|
||||||
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT), ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL),
|
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT),
|
||||||
|
ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class AllMovementBehaviours {
|
public class AllMovementBehaviours {
|
||||||
private static final HashMap<ResourceLocation, MovementBehaviour> movementBehaviours = new HashMap<>();
|
private static final HashMap<ResourceLocation, MovementBehaviour> MOVEMENT_BEHAVIOURS = new HashMap<>();
|
||||||
|
|
||||||
public static void addMovementBehaviour(ResourceLocation resourceLocation, MovementBehaviour movementBehaviour) {
|
public static void addMovementBehaviour(ResourceLocation resourceLocation, MovementBehaviour movementBehaviour) {
|
||||||
if (movementBehaviours.containsKey(resourceLocation))
|
if (MOVEMENT_BEHAVIOURS.containsKey(resourceLocation))
|
||||||
Create.logger.warn("Movement behaviour for " + resourceLocation.toString() + " was overridden");
|
Create.LOGGER.warn("Movement behaviour for " + resourceLocation.toString() + " was overridden");
|
||||||
movementBehaviours.put(resourceLocation, movementBehaviour);
|
MOVEMENT_BEHAVIOURS.put(resourceLocation, movementBehaviour);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addMovementBehaviour(Block block, MovementBehaviour movementBehaviour) {
|
public static void addMovementBehaviour(Block block, MovementBehaviour movementBehaviour) {
|
||||||
|
@ -31,7 +31,7 @@ public class AllMovementBehaviours {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static MovementBehaviour of(ResourceLocation resourceLocation) {
|
public static MovementBehaviour of(ResourceLocation resourceLocation) {
|
||||||
return movementBehaviours.getOrDefault(resourceLocation, null);
|
return MOVEMENT_BEHAVIOURS.getOrDefault(resourceLocation, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -45,7 +45,7 @@ public class AllMovementBehaviours {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean contains(Block block) {
|
public static boolean contains(Block block) {
|
||||||
return movementBehaviours.containsKey(block.getRegistryName());
|
return MOVEMENT_BEHAVIOURS.containsKey(block.getRegistryName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <B extends Block> NonNullConsumer<? super B> addMovementBehaviour(
|
public static <B extends Block> NonNullConsumer<? super B> addMovementBehaviour(
|
||||||
|
|
|
@ -2,10 +2,7 @@ package com.simibubi.create;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|
||||||
|
|
||||||
@EventBusSubscriber(value = Dist.CLIENT)
|
|
||||||
public enum AllSpecialTextures {
|
public enum AllSpecialTextures {
|
||||||
|
|
||||||
BLANK("blank.png"),
|
BLANK("blank.png"),
|
||||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraftforge.fml.ModList;
|
||||||
|
|
||||||
public class AllTags {
|
public class AllTags {
|
||||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||||
.itemGroup(() -> Create.baseCreativeTab);
|
.itemGroup(() -> Create.BASE_CREATIVE_TAB);
|
||||||
|
|
||||||
public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, ItemBuilder<BlockItem, BlockBuilder<T, P>>> tagBlockAndItem(
|
public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, ItemBuilder<BlockItem, BlockBuilder<T, P>>> tagBlockAndItem(
|
||||||
String tagName) {
|
String tagName) {
|
||||||
|
|
|
@ -159,7 +159,6 @@ import com.simibubi.create.content.schematics.block.SchematicannonInstance;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonRenderer;
|
import com.simibubi.create.content.schematics.block.SchematicannonRenderer;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity;
|
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
|
||||||
import com.tterrag.registrate.util.entry.TileEntityEntry;
|
import com.tterrag.registrate.util.entry.TileEntityEntry;
|
||||||
|
|
||||||
public class AllTileEntities {
|
public class AllTileEntities {
|
||||||
|
@ -248,10 +247,10 @@ public class AllTileEntities {
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<HandCrankTileEntity> HAND_CRANK = Create.registrate()
|
public static final TileEntityEntry<HandCrankTileEntity> HAND_CRANK = Create.registrate()
|
||||||
.tileEntity("hand_crank", HandCrankTileEntity::new)
|
.tileEntity("hand_crank", HandCrankTileEntity::new)
|
||||||
.instance(() -> HandCrankInstance::new)
|
.instance(() -> HandCrankInstance::new)
|
||||||
.validBlocks(AllBlocks.HAND_CRANK, AllBlocks.COPPER_VALVE_HANDLE)
|
.validBlocks(AllBlocks.HAND_CRANK, AllBlocks.COPPER_VALVE_HANDLE)
|
||||||
.validBlocks(AllBlocks.DYED_VALVE_HANDLES.toArray(new BlockEntry<?>[AllBlocks.DYED_VALVE_HANDLES.size()]))
|
.validBlocks(AllBlocks.DYED_VALVE_HANDLES)
|
||||||
.renderer(() -> HandCrankRenderer::new)
|
.renderer(() -> HandCrankRenderer::new)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
||||||
import com.tterrag.registrate.util.NonNullLazyValue;
|
import com.tterrag.registrate.util.NonNullLazyValue;
|
||||||
|
|
||||||
import net.minecraft.data.DataGenerator;
|
import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.inventory.container.ContainerType;
|
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||||
import net.minecraft.particles.ParticleType;
|
import net.minecraft.particles.ParticleType;
|
||||||
|
@ -57,52 +56,52 @@ public class Create {
|
||||||
public static final String NAME = "Create";
|
public static final String NAME = "Create";
|
||||||
public static final String VERSION = "0.3.1c";
|
public static final String VERSION = "0.3.1c";
|
||||||
|
|
||||||
public static Logger logger = LogManager.getLogger();
|
public static final Logger LOGGER = LogManager.getLogger();
|
||||||
public static ItemGroup baseCreativeTab = new CreateItemGroup();
|
|
||||||
public static ItemGroup palettesCreativeTab = new PalettesItemGroup();
|
|
||||||
|
|
||||||
public static Gson GSON = new GsonBuilder().setPrettyPrinting()
|
public static final Gson GSON = new GsonBuilder().setPrettyPrinting()
|
||||||
.disableHtmlEscaping()
|
.disableHtmlEscaping()
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
public static ServerSchematicLoader schematicReceiver;
|
public static final ItemGroup BASE_CREATIVE_TAB = new CreateItemGroup();
|
||||||
public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler;
|
public static final ItemGroup PALETTES_CREATIVE_TAB = new PalettesItemGroup();
|
||||||
public static TorquePropagator torquePropagator;
|
|
||||||
public static ServerLagger lagger;
|
|
||||||
public static ChunkUtil chunkUtil;
|
|
||||||
public static Random random;
|
|
||||||
|
|
||||||
private static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(ID);
|
public static final ServerSchematicLoader SCHEMATIC_RECEIVER = new ServerSchematicLoader();
|
||||||
|
public static final RedstoneLinkNetworkHandler REDSTONE_LINK_NETWORK_HANDLER = new RedstoneLinkNetworkHandler();
|
||||||
|
public static final TorquePropagator TORQUE_PROPAGATOR = new TorquePropagator();
|
||||||
|
public static final ServerLagger LAGGER = new ServerLagger();
|
||||||
|
public static final ChunkUtil CHUNK_UTIL = new ChunkUtil();
|
||||||
|
public static final Random RANDOM = new Random();
|
||||||
|
|
||||||
|
private static final NonNullLazyValue<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID);
|
||||||
|
|
||||||
public Create() {
|
public Create() {
|
||||||
IEventBus modEventBus = FMLJavaModLoadingContext.get()
|
|
||||||
.getModEventBus();
|
|
||||||
|
|
||||||
AllSoundEvents.prepare();
|
AllSoundEvents.prepare();
|
||||||
AllBlocks.register();
|
AllBlocks.register();
|
||||||
AllItems.register();
|
AllItems.register();
|
||||||
AllFluids.register();
|
AllFluids.register();
|
||||||
AllTags.register();
|
AllTags.register();
|
||||||
AllPaletteBlocks.register();
|
AllPaletteBlocks.register();
|
||||||
|
AllContainerTypes.register();
|
||||||
AllEntityTypes.register();
|
AllEntityTypes.register();
|
||||||
AllTileEntities.register();
|
AllTileEntities.register();
|
||||||
AllMovementBehaviours.register();
|
AllMovementBehaviours.register();
|
||||||
AllWorldFeatures.register();
|
AllWorldFeatures.register();
|
||||||
|
AllConfigs.register();
|
||||||
|
|
||||||
|
IEventBus modEventBus = FMLJavaModLoadingContext.get()
|
||||||
|
.getModEventBus();
|
||||||
|
IEventBus forgeEventBus = MinecraftForge.EVENT_BUS;
|
||||||
|
|
||||||
modEventBus.addListener(Create::init);
|
modEventBus.addListener(Create::init);
|
||||||
MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, Create::onBiomeLoad);
|
|
||||||
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
|
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
|
||||||
modEventBus.addGenericListener(Placement.class, AllWorldFeatures::registerDecoratorFeatures);
|
modEventBus.addGenericListener(Placement.class, AllWorldFeatures::registerDecoratorFeatures);
|
||||||
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipeTypes::register);
|
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipeTypes::register);
|
||||||
modEventBus.addGenericListener(ContainerType.class, AllContainerTypes::register);
|
|
||||||
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
||||||
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
||||||
modEventBus.addListener(AllConfigs::onLoad);
|
modEventBus.addListener(AllConfigs::onLoad);
|
||||||
modEventBus.addListener(AllConfigs::onReload);
|
modEventBus.addListener(AllConfigs::onReload);
|
||||||
modEventBus.addListener(EventPriority.LOWEST, this::gatherData);
|
modEventBus.addListener(EventPriority.LOWEST, this::gatherData);
|
||||||
|
forgeEventBus.addListener(EventPriority.HIGH, Create::onBiomeLoad);
|
||||||
AllConfigs.register();
|
|
||||||
random = new Random();
|
|
||||||
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.addClientListeners(modEventBus));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.addClientListeners(modEventBus));
|
||||||
}
|
}
|
||||||
|
@ -110,14 +109,9 @@ public class Create {
|
||||||
public static void init(final FMLCommonSetupEvent event) {
|
public static void init(final FMLCommonSetupEvent event) {
|
||||||
CapabilityMinecartController.register();
|
CapabilityMinecartController.register();
|
||||||
SchematicInstances.register();
|
SchematicInstances.register();
|
||||||
schematicReceiver = new ServerSchematicLoader();
|
|
||||||
redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler();
|
|
||||||
torquePropagator = new TorquePropagator();
|
|
||||||
lagger = new ServerLagger();
|
|
||||||
|
|
||||||
chunkUtil = new ChunkUtil();
|
CHUNK_UTIL.init();
|
||||||
chunkUtil.init();
|
MinecraftForge.EVENT_BUS.register(CHUNK_UTIL);
|
||||||
MinecraftForge.EVENT_BUS.register(chunkUtil);
|
|
||||||
|
|
||||||
AllPackets.registerPackets();
|
AllPackets.registerPackets();
|
||||||
AllTriggers.register();
|
AllTriggers.register();
|
||||||
|
@ -128,18 +122,6 @@ public class Create {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onBiomeLoad(BiomeLoadingEvent event) {
|
|
||||||
AllWorldFeatures.reload(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CreateRegistrate registrate() {
|
|
||||||
return registrate.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ResourceLocation asResource(String path) {
|
|
||||||
return new ResourceLocation(ID, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void gatherData(GatherDataEvent event) {
|
public void gatherData(GatherDataEvent event) {
|
||||||
DataGenerator gen = event.getGenerator();
|
DataGenerator gen = event.getGenerator();
|
||||||
gen.addProvider(new AllAdvancements(gen));
|
gen.addProvider(new AllAdvancements(gen));
|
||||||
|
@ -150,4 +132,16 @@ public class Create {
|
||||||
ProcessingRecipeGen.registerAll(gen);
|
ProcessingRecipeGen.registerAll(gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onBiomeLoad(BiomeLoadingEvent event) {
|
||||||
|
AllWorldFeatures.reload(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CreateRegistrate registrate() {
|
||||||
|
return REGISTRATE.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation asResource(String path) {
|
||||||
|
return new ResourceLocation(ID, path);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,12 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
|
||||||
public class CreateClient {
|
public class CreateClient {
|
||||||
|
|
||||||
public static ClientSchematicLoader schematicSender;
|
public static final ClientSchematicLoader SCHEMATIC_SENDER = new ClientSchematicLoader();
|
||||||
public static SchematicHandler schematicHandler;
|
public static final SchematicHandler SCHEMATIC_HANDLER = new SchematicHandler();
|
||||||
public static SchematicAndQuillHandler schematicAndQuillHandler;
|
public static final SchematicAndQuillHandler SCHEMATIC_AND_QUILL_HANDLER = new SchematicAndQuillHandler();
|
||||||
public static SuperByteBufferCache bufferCache;
|
public static final SuperByteBufferCache BUFFER_CACHE = new SuperByteBufferCache();
|
||||||
public static final Outliner outliner = new Outliner();
|
public static final Outliner OUTLINER = new Outliner();
|
||||||
public static GhostBlocks ghostBlocks;
|
public static final GhostBlocks GHOST_BLOCKS = new GhostBlocks();
|
||||||
|
|
||||||
private static CustomBlockModels customBlockModels;
|
private static CustomBlockModels customBlockModels;
|
||||||
private static CustomItemModels customItemModels;
|
private static CustomItemModels customItemModels;
|
||||||
|
@ -77,9 +77,10 @@ public class CreateClient {
|
||||||
|
|
||||||
public static void addClientListeners(IEventBus modEventBus) {
|
public static void addClientListeners(IEventBus modEventBus) {
|
||||||
modEventBus.addListener(CreateClient::clientInit);
|
modEventBus.addListener(CreateClient::clientInit);
|
||||||
modEventBus.addListener(CreateClient::onModelBake);
|
modEventBus.register(getColorHandler());
|
||||||
modEventBus.addListener(CreateClient::onModelRegistry);
|
|
||||||
modEventBus.addListener(CreateClient::onTextureStitch);
|
modEventBus.addListener(CreateClient::onTextureStitch);
|
||||||
|
modEventBus.addListener(CreateClient::onModelRegistry);
|
||||||
|
modEventBus.addListener(CreateClient::onModelBake);
|
||||||
modEventBus.addListener(AllParticleTypes::registerFactories);
|
modEventBus.addListener(AllParticleTypes::registerFactories);
|
||||||
modEventBus.addListener(ClientEvents::loadCompleted);
|
modEventBus.addListener(ClientEvents::loadCompleted);
|
||||||
|
|
||||||
|
@ -91,35 +92,24 @@ public class CreateClient {
|
||||||
public static void clientInit(FMLClientSetupEvent event) {
|
public static void clientInit(FMLClientSetupEvent event) {
|
||||||
AllMaterialSpecs.init();
|
AllMaterialSpecs.init();
|
||||||
|
|
||||||
schematicSender = new ClientSchematicLoader();
|
BUFFER_CACHE.registerCompartment(KineticTileEntityRenderer.KINETIC_TILE);
|
||||||
schematicHandler = new SchematicHandler();
|
BUFFER_CACHE.registerCompartment(ContraptionRenderDispatcher.CONTRAPTION, 20);
|
||||||
schematicAndQuillHandler = new SchematicAndQuillHandler();
|
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
|
||||||
|
|
||||||
bufferCache = new SuperByteBufferCache();
|
|
||||||
bufferCache.registerCompartment(KineticTileEntityRenderer.KINETIC_TILE);
|
|
||||||
bufferCache.registerCompartment(ContraptionRenderDispatcher.CONTRAPTION, 20);
|
|
||||||
bufferCache.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
|
|
||||||
|
|
||||||
ghostBlocks = new GhostBlocks();
|
|
||||||
|
|
||||||
AllKeys.register();
|
AllKeys.register();
|
||||||
AllContainerTypes.registerScreenFactories();
|
// AllFluids.assignRenderLayers();
|
||||||
// AllTileEntities.registerRenderers();
|
AllBlockPartials.clientInit();
|
||||||
AllEntityTypes.registerRenderers();
|
|
||||||
getColorHandler().init();
|
|
||||||
AllFluids.assignRenderLayers();
|
|
||||||
PonderIndex.register();
|
PonderIndex.register();
|
||||||
PonderIndex.registerTags();
|
PonderIndex.registerTags();
|
||||||
|
|
||||||
UIRenderHelper.init();
|
UIRenderHelper.init();
|
||||||
|
|
||||||
IResourceManager resourceManager = Minecraft.getInstance()
|
IResourceManager resourceManager = Minecraft.getInstance()
|
||||||
.getResourceManager();
|
.getResourceManager();
|
||||||
if (resourceManager instanceof IReloadableResourceManager)
|
if (resourceManager instanceof IReloadableResourceManager)
|
||||||
((IReloadableResourceManager) resourceManager).addReloadListener(new ResourceReloadHandler());
|
((IReloadableResourceManager) resourceManager).addReloadListener(new ResourceReloadHandler());
|
||||||
|
|
||||||
AllBlockPartials.clientInit();
|
|
||||||
|
|
||||||
event.enqueueWork(() -> {
|
event.enqueueWork(() -> {
|
||||||
CopperBacktankArmorLayer.register();
|
CopperBacktankArmorLayer.register();
|
||||||
});
|
});
|
||||||
|
@ -127,11 +117,19 @@ public class CreateClient {
|
||||||
|
|
||||||
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
||||||
if (!event.getMap()
|
if (!event.getMap()
|
||||||
.getId()
|
.getId()
|
||||||
.equals(PlayerContainer.BLOCK_ATLAS_TEXTURE))
|
.equals(PlayerContainer.BLOCK_ATLAS_TEXTURE))
|
||||||
return;
|
return;
|
||||||
SpriteShifter.getAllTargetSprites()
|
SpriteShifter.getAllTargetSprites()
|
||||||
.forEach(event::addSprite);
|
.forEach(event::addSprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onModelRegistry(ModelRegistryEvent event) {
|
||||||
|
PartialModel.onModelRegistry(event);
|
||||||
|
|
||||||
|
getCustomRenderedItems().foreach((item, modelFunc) -> modelFunc.apply(null)
|
||||||
|
.getModelLocations()
|
||||||
|
.forEach(ModelLoader::addSpecialModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onModelBake(ModelBakeEvent event) {
|
public static void onModelBake(ModelBakeEvent event) {
|
||||||
|
@ -139,23 +137,15 @@ public class CreateClient {
|
||||||
PartialModel.onModelBake(event);
|
PartialModel.onModelBake(event);
|
||||||
|
|
||||||
getCustomBlockModels()
|
getCustomBlockModels()
|
||||||
.foreach((block, modelFunc) -> swapModels(modelRegistry, getAllBlockStateModelLocations(block), modelFunc));
|
.foreach((block, modelFunc) -> swapModels(modelRegistry, getAllBlockStateModelLocations(block), modelFunc));
|
||||||
getCustomItemModels()
|
getCustomItemModels()
|
||||||
.foreach((item, modelFunc) -> swapModels(modelRegistry, getItemModelLocation(item), modelFunc));
|
.foreach((item, modelFunc) -> swapModels(modelRegistry, getItemModelLocation(item), modelFunc));
|
||||||
getCustomRenderedItems().foreach((item, modelFunc) -> {
|
getCustomRenderedItems().foreach((item, modelFunc) -> {
|
||||||
swapModels(modelRegistry, getItemModelLocation(item), m -> modelFunc.apply(m)
|
swapModels(modelRegistry, getItemModelLocation(item), m -> modelFunc.apply(m)
|
||||||
.loadPartials(event));
|
.loadPartials(event));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onModelRegistry(ModelRegistryEvent event) {
|
|
||||||
PartialModel.onModelRegistry(event);
|
|
||||||
|
|
||||||
getCustomRenderedItems().foreach((item, modelFunc) -> modelFunc.apply(null)
|
|
||||||
.getModelLocations()
|
|
||||||
.forEach(ModelLoader::addSpecialModel));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static ModelResourceLocation getItemModelLocation(Item item) {
|
protected static ModelResourceLocation getItemModelLocation(Item item) {
|
||||||
return new ModelResourceLocation(item.getRegistryName(), "inventory");
|
return new ModelResourceLocation(item.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
@ -221,7 +211,7 @@ public class CreateClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void invalidateRenderers(@Nullable IWorld world) {
|
public static void invalidateRenderers(@Nullable IWorld world) {
|
||||||
bufferCache.invalidate();
|
BUFFER_CACHE.invalidate();
|
||||||
|
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
Backend.tileRenderer.get(world)
|
Backend.tileRenderer.get(world)
|
||||||
|
|
|
@ -28,11 +28,11 @@ public class KineticDebugger {
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
if (KineticTileEntityRenderer.rainbowMode) {
|
if (KineticTileEntityRenderer.rainbowMode) {
|
||||||
KineticTileEntityRenderer.rainbowMode = false;
|
KineticTileEntityRenderer.rainbowMode = false;
|
||||||
CreateClient.bufferCache.invalidate();
|
CreateClient.BUFFER_CACHE.invalidate();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KineticTileEntity te = getSelectedTE();
|
KineticTileEntity te = getSelectedTE();
|
||||||
if (te == null)
|
if (te == null)
|
||||||
return;
|
return;
|
||||||
|
@ -44,18 +44,18 @@ public class KineticDebugger {
|
||||||
.getRenderShape(world, toOutline);
|
.getRenderShape(world, toOutline);
|
||||||
|
|
||||||
if (te.getTheoreticalSpeed() != 0 && !shape.isEmpty())
|
if (te.getTheoreticalSpeed() != 0 && !shape.isEmpty())
|
||||||
CreateClient.outliner.chaseAABB("kineticSource", shape.getBoundingBox()
|
CreateClient.OUTLINER.chaseAABB("kineticSource", shape.getBoundingBox()
|
||||||
.offset(toOutline))
|
.offset(toOutline))
|
||||||
.lineWidth(1 / 16f)
|
.lineWidth(1 / 16f)
|
||||||
.colored(te.hasSource() ? ColorHelper.colorFromLong(te.network) : 0xffcc00);
|
.colored(te.hasSource() ? ColorHelper.colorFromLong(te.network) : 0xffcc00);
|
||||||
|
|
||||||
if (state.getBlock() instanceof IRotate) {
|
if (state.getBlock() instanceof IRotate) {
|
||||||
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
||||||
Vector3d vec = Vector3d.of(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
|
Vector3d vec = Vector3d.of(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
|
||||||
.getDirectionVec());
|
.getDirectionVec());
|
||||||
Vector3d center = VecHelper.getCenterOf(te.getPos());
|
Vector3d center = VecHelper.getCenterOf(te.getPos());
|
||||||
CreateClient.outliner.showLine("rotationAxis", center.add(vec), center.subtract(vec))
|
CreateClient.OUTLINER.showLine("rotationAxis", center.add(vec), center.subtract(vec))
|
||||||
.lineWidth(1 / 16f);
|
.lineWidth(1 / 16f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@ public class TorquePropagator {
|
||||||
|
|
||||||
public void onLoadWorld(IWorld world) {
|
public void onLoadWorld(IWorld world) {
|
||||||
networks.put(world, new HashMap<>());
|
networks.put(world, new HashMap<>());
|
||||||
Create.logger.debug("Prepared Kinetic Network Space for " + WorldHelper.getDimensionID(world));
|
Create.LOGGER.debug("Prepared Kinetic Network Space for " + WorldHelper.getDimensionID(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUnloadWorld(IWorld world) {
|
public void onUnloadWorld(IWorld world) {
|
||||||
networks.remove(world);
|
networks.remove(world);
|
||||||
Create.logger.debug("Removed Kinetic Network Space for " + WorldHelper.getDimensionID(world));
|
Create.LOGGER.debug("Removed Kinetic Network Space for " + WorldHelper.getDimensionID(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public KineticNetwork getOrCreateNetworkFor(KineticTileEntity te) {
|
public KineticNetwork getOrCreateNetworkFor(KineticTileEntity te) {
|
||||||
|
|
|
@ -329,7 +329,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
public KineticNetwork getOrCreateNetwork() {
|
public KineticNetwork getOrCreateNetwork() {
|
||||||
return Create.torquePropagator.getOrCreateNetworkFor(this);
|
return Create.TORQUE_PROPAGATOR.getOrCreateNetworkFor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNetwork() {
|
public boolean hasNetwork() {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||||
|
|
||||||
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms,
|
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms,
|
||||||
IVertexBuilder buffer, int light) {
|
IVertexBuilder buffer, int light) {
|
||||||
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState);
|
SuperByteBuffer superByteBuffer = CreateClient.BUFFER_CACHE.renderBlockIn(KINETIC_TILE, renderedState);
|
||||||
renderRotatingBuffer(te, superByteBuffer, ms, buffer, light);
|
renderRotatingBuffer(te, superByteBuffer, ms, buffer, light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, getRenderedBlockState(te));
|
return CreateClient.BUFFER_CACHE.renderBlockIn(KINETIC_TILE, getRenderedBlockState(te));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,14 +43,14 @@ public class ValveHandleBlock extends HandCrankBlock {
|
||||||
ItemStack heldItem = player.getHeldItem(handIn);
|
ItemStack heldItem = player.getHeldItem(handIn);
|
||||||
for (DyeColor color : DyeColor.values()) {
|
for (DyeColor color : DyeColor.values()) {
|
||||||
if (!heldItem.getItem()
|
if (!heldItem.getItem()
|
||||||
.isIn(DyeHelper.getTagOfDye(color)))
|
.isIn(DyeHelper.getTagOfDye(color)))
|
||||||
continue;
|
continue;
|
||||||
if (worldIn.isRemote)
|
if (worldIn.isRemote)
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
|
|
||||||
BlockState newState = AllBlocks.DYED_VALVE_HANDLES.get(color.ordinal())
|
BlockState newState = AllBlocks.DYED_VALVE_HANDLES[color.ordinal()]
|
||||||
.getDefaultState()
|
.getDefaultState()
|
||||||
.with(FACING, state.get(FACING));
|
.with(FACING, state.get(FACING));
|
||||||
if (newState != state)
|
if (newState != state)
|
||||||
worldIn.setBlockState(pos, newState);
|
worldIn.setBlockState(pos, newState);
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class BeltDeployerCallbacks {
|
||||||
boolean centered = BeltHelper.isItemUpright(stack);
|
boolean centered = BeltHelper.isItemUpright(stack);
|
||||||
copy.stack = stack;
|
copy.stack = stack;
|
||||||
copy.locked = true;
|
copy.locked = true;
|
||||||
copy.angle = centered ? 180 : Create.random.nextInt(360);
|
copy.angle = centered ? 180 : Create.RANDOM.nextInt(360);
|
||||||
return copy;
|
return copy;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
|
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlockItem;
|
||||||
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
|
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
||||||
|
@ -24,6 +25,7 @@ import net.minecraft.block.BeehiveBlock;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.DoublePlantBlock;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -44,6 +46,7 @@ import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.server.management.PlayerInteractionManager;
|
import net.minecraft.server.management.PlayerInteractionManager;
|
||||||
|
import net.minecraft.state.properties.DoubleBlockHalf;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
|
@ -267,17 +270,19 @@ public class DeployerHandler {
|
||||||
boolean holdingSomething = !player.getHeldItemMainhand()
|
boolean holdingSomething = !player.getHeldItemMainhand()
|
||||||
.isEmpty();
|
.isEmpty();
|
||||||
boolean flag1 =
|
boolean flag1 =
|
||||||
!(player.isSneaking() && holdingSomething) || (stack.doesSneakBypassUse(world, clickedPos, player));
|
!(player.isSneaking() && holdingSomething) || (stack.doesSneakBypassUse(world, clickedPos, player));
|
||||||
|
|
||||||
// Use on block
|
// Use on block
|
||||||
if (useBlock != DENY && flag1
|
if (useBlock != DENY && flag1
|
||||||
&& safeOnUse(clickedState, world, clickedPos, player, hand, result) == ActionResultType.SUCCESS)
|
&& safeOnUse(clickedState, world, clickedPos, player, hand, result) == ActionResultType.SUCCESS)
|
||||||
return;
|
return;
|
||||||
if (stack.isEmpty())
|
if (stack.isEmpty())
|
||||||
return;
|
return;
|
||||||
if (useItem == DENY)
|
if (useItem == DENY)
|
||||||
return;
|
return;
|
||||||
if (item instanceof BlockItem && !clickedState.isReplaceable(new BlockItemUseContext(itemusecontext)))
|
if (item instanceof BlockItem
|
||||||
|
&& !(item instanceof CartAssemblerBlockItem)
|
||||||
|
&& !clickedState.isReplaceable(new BlockItemUseContext(itemusecontext)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Reposition fire placement for convenience
|
// Reposition fire placement for convenience
|
||||||
|
@ -349,16 +354,30 @@ public class DeployerHandler {
|
||||||
prevHeldItem.onBlockDestroyed(world, blockstate, pos, player);
|
prevHeldItem.onBlockDestroyed(world, blockstate, pos, player);
|
||||||
if (prevHeldItem.isEmpty() && !heldItem.isEmpty())
|
if (prevHeldItem.isEmpty() && !heldItem.isEmpty())
|
||||||
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldItem, Hand.MAIN_HAND);
|
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldItem, Hand.MAIN_HAND);
|
||||||
if (!blockstate.removedByPlayer(world, pos, player, canHarvest, world.getFluidState(pos)))
|
|
||||||
return true;
|
|
||||||
|
BlockPos posUp = pos.up();
|
||||||
|
BlockState stateUp = world.getBlockState(posUp);
|
||||||
|
if (blockstate.getBlock() instanceof DoublePlantBlock
|
||||||
|
&& blockstate.get(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER
|
||||||
|
&& stateUp.getBlock() == blockstate.getBlock()
|
||||||
|
&& stateUp.get(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER
|
||||||
|
) {
|
||||||
|
// hack to prevent DoublePlantBlock from dropping a duplicate item
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 35);
|
||||||
|
world.setBlockState(posUp, Blocks.AIR.getDefaultState(), 35);
|
||||||
|
} else {
|
||||||
|
if (!blockstate.removedByPlayer(world, pos, player, canHarvest, world.getFluidState(pos)))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
blockstate.getBlock()
|
blockstate.getBlock()
|
||||||
.onPlayerDestroy(world, pos, blockstate);
|
.onPlayerDestroy(world, pos, blockstate);
|
||||||
if (!canHarvest)
|
if (!canHarvest)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Block.getDrops(blockstate, world, pos, tileentity, player, prevHeldItem)
|
Block.getDrops(blockstate, world, pos, tileentity, player, prevHeldItem)
|
||||||
.forEach(item -> player.inventory.placeItemBackInInventory(world, item));
|
.forEach(item -> player.inventory.placeItemBackInInventory(world, item));
|
||||||
blockstate.spawnAdditionalDrops(world, pos, prevHeldItem);
|
blockstate.spawnAdditionalDrops(world, pos, prevHeldItem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,31 +105,31 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
if (schematicWorld == null)
|
if (schematicWorld == null)
|
||||||
return;
|
return;
|
||||||
if (!schematicWorld.getBounds()
|
if (!schematicWorld.getBounds()
|
||||||
.isVecInside(pos.subtract(schematicWorld.anchor)))
|
.isVecInside(pos.subtract(schematicWorld.anchor)))
|
||||||
return;
|
return;
|
||||||
BlockState blockState = schematicWorld.getBlockState(pos);
|
BlockState blockState = schematicWorld.getBlockState(pos);
|
||||||
ItemRequirement requirement = ItemRequirement.of(blockState);
|
ItemRequirement requirement = ItemRequirement.of(blockState, schematicWorld.getTileEntity(pos));
|
||||||
if (requirement.isInvalid() || requirement.isEmpty())
|
if (requirement.isInvalid() || requirement.isEmpty())
|
||||||
return;
|
return;
|
||||||
if (AllBlocks.BELT.has(blockState))
|
if (AllBlocks.BELT.has(blockState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<ItemStack> requiredItems = requirement.getRequiredItems();
|
List<ItemRequirement.StackRequirement> requiredItems = requirement.getRequiredItems();
|
||||||
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
|
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).item;
|
||||||
|
|
||||||
if (!context.contraption.hasUniversalCreativeCrate) {
|
if (!context.contraption.hasUniversalCreativeCrate) {
|
||||||
IItemHandler iItemHandler = context.contraption.inventory;
|
IItemHandler iItemHandler = context.contraption.inventory;
|
||||||
for (ItemStack required : requiredItems) {
|
for (ItemRequirement.StackRequirement required : requiredItems) {
|
||||||
int amountFound = ItemHelper
|
int amountFound = ItemHelper
|
||||||
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
.extract(iItemHandler, s -> ItemRequirement.validate(required.item, s), ExtractionCountMode.UPTO,
|
||||||
required.getCount(), true)
|
required.item.getCount(), true)
|
||||||
.getCount();
|
.getCount();
|
||||||
if (amountFound < required.getCount())
|
if (amountFound < required.item.getCount())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (ItemStack required : requiredItems)
|
for (ItemRequirement.StackRequirement required : requiredItems)
|
||||||
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required.item, s), ExtractionCountMode.UPTO,
|
||||||
required.getCount(), false);
|
required.item.getCount(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundNBT data = null;
|
CompoundNBT data = null;
|
||||||
|
|
|
@ -89,8 +89,7 @@ public class AirCurrent {
|
||||||
protected void tickAffectedEntities(World world, Direction facing) {
|
protected void tickAffectedEntities(World world, Direction facing) {
|
||||||
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
|
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
|
||||||
Entity entity = iterator.next();
|
Entity entity = iterator.next();
|
||||||
if (!entity.isAlive() || !entity.getBoundingBox()
|
if (!entity.isAlive() || !entity.getBoundingBox().intersects(bounds) || isPlayerCreativeFlying(entity)) {
|
||||||
.intersects(bounds)) {
|
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -389,4 +388,12 @@ public class AirCurrent {
|
||||||
isClientPlayerInAirCurrent = false;
|
isClientPlayerInAirCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPlayerCreativeFlying(Entity entity) {
|
||||||
|
if (entity instanceof PlayerEntity) {
|
||||||
|
PlayerEntity player = (PlayerEntity) entity;
|
||||||
|
return player.isCreative() && player.abilities.isFlying;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
compound.putFloat("Range", range);
|
compound.putFloat("Range", range);
|
||||||
compound.putBoolean("Pushing", pushing);
|
compound.putBoolean("Pushing", pushing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
|
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
|
||||||
super.fromTag(state, compound, clientPacket);
|
super.fromTag(state, compound, clientPacket);
|
||||||
|
@ -89,14 +89,13 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
for (Iterator<Entity> iterator = pushingEntities.iterator(); iterator.hasNext();) {
|
for (Iterator<Entity> iterator = pushingEntities.iterator(); iterator.hasNext();) {
|
||||||
Entity entity = iterator.next();
|
Entity entity = iterator.next();
|
||||||
Vector3d diff = entity.getPositionVec()
|
Vector3d diff = entity.getPositionVec()
|
||||||
.subtract(center);
|
.subtract(center);
|
||||||
|
|
||||||
if (!(entity instanceof PlayerEntity) && world.isRemote)
|
if (!(entity instanceof PlayerEntity) && world.isRemote)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double distance = diff.length();
|
double distance = diff.length();
|
||||||
if (distance > range || entity.isSneaking()
|
if (distance > range || entity.isSneaking() || AirCurrent.isPlayerCreativeFlying(entity)) {
|
||||||
|| (entity instanceof PlayerEntity && ((PlayerEntity) entity).isCreative())) {
|
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +105,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
float factor = (entity instanceof ItemEntity) ? 1 / 128f : 1 / 32f;
|
float factor = (entity instanceof ItemEntity) ? 1 / 128f : 1 / 32f;
|
||||||
Vector3d pushVec = diff.normalize()
|
Vector3d pushVec = diff.normalize()
|
||||||
.scale((range - distance) * (pushing ? 1 : -1));
|
.scale((range - distance) * (pushing ? 1 : -1));
|
||||||
entity.setMotion(entity.getMotion()
|
entity.setMotion(entity.getMotion()
|
||||||
.add(pushVec.scale(factor)));
|
.add(pushVec.scale(factor)));
|
||||||
entity.fallDistance = 0;
|
entity.fallDistance = 0;
|
||||||
|
@ -150,13 +149,11 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
for (Entity entity : world.getEntitiesWithinAABB(Entity.class, bb)) {
|
for (Entity entity : world.getEntitiesWithinAABB(Entity.class, bb)) {
|
||||||
Vector3d diff = entity.getPositionVec()
|
Vector3d diff = entity.getPositionVec()
|
||||||
.subtract(center);
|
.subtract(center);
|
||||||
|
|
||||||
double distance = diff.length();
|
double distance = diff.length();
|
||||||
if (distance > range || entity.isSneaking()
|
if (distance > range || entity.isSneaking() || AirCurrent.isPlayerCreativeFlying(entity))
|
||||||
|| (entity instanceof PlayerEntity && ((PlayerEntity) entity).isCreative())) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
boolean canSee = canSee(entity);
|
boolean canSee = canSee(entity);
|
||||||
if (!canSee) {
|
if (!canSee) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class MillstoneRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return CreateClient.bufferCache.renderPartial(AllBlockPartials.MILLSTONE_COG, te.getBlockState());
|
return CreateClient.BUFFER_CACHE.renderPartial(AllBlockPartials.MILLSTONE_COG, te.getBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class BeltPressingCallbacks {
|
||||||
boolean centered = BeltHelper.isItemUpright(stack);
|
boolean centered = BeltHelper.isItemUpright(stack);
|
||||||
copy.stack = stack;
|
copy.stack = stack;
|
||||||
copy.locked = true;
|
copy.locked = true;
|
||||||
copy.angle = centered ? 180 : Create.random.nextInt(360);
|
copy.angle = centered ? 180 : Create.RANDOM.nextInt(360);
|
||||||
return copy;
|
return copy;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
||||||
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION_ON_BELT.playOnServer(world, pos);
|
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION_ON_BELT.playOnServer(world, pos);
|
||||||
else
|
else
|
||||||
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.playOnServer(world, pos, .5f, .75f + (Math.abs(getSpeed()) / 1024f));
|
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.playOnServer(world, pos, .5f, .75f + (Math.abs(getSpeed()) / 1024f));
|
||||||
|
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
sendData();
|
sendData();
|
||||||
}
|
}
|
||||||
|
@ -258,9 +258,9 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
||||||
for (ItemStack result : InWorldProcessing.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(item, 1),
|
for (ItemStack result : InWorldProcessing.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(item, 1),
|
||||||
recipe.get())) {
|
recipe.get())) {
|
||||||
ItemEntity created =
|
ItemEntity created =
|
||||||
new ItemEntity(world, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), result);
|
new ItemEntity(world, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), result);
|
||||||
created.setDefaultPickupDelay();
|
created.setDefaultPickupDelay();
|
||||||
created.setMotion(VecHelper.offsetRandomly(Vector3d.ZERO, Create.random, .05f));
|
created.setMotion(VecHelper.offsetRandomly(Vector3d.ZERO, Create.RANDOM, .05f));
|
||||||
world.addEntity(created);
|
world.addEntity(created);
|
||||||
}
|
}
|
||||||
item.shrink(1);
|
item.shrink(1);
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
if (state.get(FACING).getAxis().isHorizontal())
|
if (state.get(FACING).getAxis().isHorizontal())
|
||||||
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, state.rotate(te.getWorld(), te.getPos(), Rotation.CLOCKWISE_180));
|
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, state.rotate(te.getWorld(), te.getPos(), Rotation.CLOCKWISE_180));
|
||||||
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
return CreateClient.BUFFER_CACHE.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
||||||
getRenderedBlockState(te));
|
getRenderedBlockState(te));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,5 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.IdentityHashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
|
||||||
import org.apache.commons.lang3.tuple.MutablePair;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
|
||||||
import com.google.common.io.ByteStreams;
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
|
||||||
import com.simibubi.create.AllMovementBehaviours;
|
|
||||||
import com.simibubi.create.Create;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.SeatEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionSeatMappingPacket;
|
|
||||||
import com.simibubi.create.foundation.collision.Matrix3d;
|
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
|
||||||
|
|
||||||
import net.minecraft.block.material.PushReaction;
|
import net.minecraft.block.material.PushReaction;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -54,10 +29,31 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||||
import net.minecraftforge.fml.network.NetworkHooks;
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
import net.minecraftforge.fml.network.PacketDistributor;
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.AllMovementBehaviours;
|
||||||
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.content.contraptions.components.actors.SeatEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionSeatMappingPacket;
|
||||||
|
import com.simibubi.create.foundation.collision.Matrix3d;
|
||||||
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
public abstract class AbstractContraptionEntity extends Entity implements IEntityAdditionalSpawnData {
|
public abstract class AbstractContraptionEntity extends Entity implements IEntityAdditionalSpawnData {
|
||||||
|
|
||||||
private static final DataParameter<Boolean> STALLED =
|
private static final DataParameter<Boolean> STALLED =
|
||||||
EntityDataManager.createKey(AbstractContraptionEntity.class, DataSerializers.BOOLEAN);
|
EntityDataManager.createKey(AbstractContraptionEntity.class, DataSerializers.BOOLEAN);
|
||||||
|
|
||||||
public final Map<Entity, MutableInt> collidingEntities;
|
public final Map<Entity, MutableInt> collidingEntities;
|
||||||
|
|
||||||
|
@ -391,8 +387,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
||||||
byte[] byteArray = dataOutput.toByteArray();
|
byte[] byteArray = dataOutput.toByteArray();
|
||||||
int estimatedPacketSize = byteArray.length;
|
int estimatedPacketSize = byteArray.length;
|
||||||
if (estimatedPacketSize > 2_000_000) {
|
if (estimatedPacketSize > 2_000_000) {
|
||||||
Create.logger.warn("Could not send Contraption Spawn Data (Packet too big): "
|
Create.LOGGER.warn("Could not send Contraption Spawn Data (Packet too big): "
|
||||||
+ getContraption().getType().id + " @" + getPositionVec() + " (" + getUniqueID().toString() + ")");
|
+ getContraption().getType().id + " @" + getPositionVec() + " (" + getUniqueID().toString() + ")");
|
||||||
buffer.writeCompoundTag(new CompoundNBT());
|
buffer.writeCompoundTag(new CompoundNBT());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +427,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
||||||
protected void readAdditional(CompoundNBT compound, boolean spawnData) {
|
protected void readAdditional(CompoundNBT compound, boolean spawnData) {
|
||||||
if (compound.isEmpty())
|
if (compound.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
initialized = compound.getBoolean("Initialized");
|
initialized = compound.getBoolean("Initialized");
|
||||||
contraption = Contraption.fromNBT(world, compound.getCompound("Contraption"), spawnData);
|
contraption = Contraption.fromNBT(world, compound.getCompound("Contraption"), spawnData);
|
||||||
contraption.entity = this;
|
contraption.entity = this;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
import com.simibubi.create.content.contraptions.components.actors.AttachedActorBlock;
|
import com.simibubi.create.content.contraptions.components.actors.AttachedActorBlock;
|
||||||
|
@ -53,29 +56,132 @@ import net.minecraft.state.properties.AttachFace;
|
||||||
import net.minecraft.state.properties.BedPart;
|
import net.minecraft.state.properties.BedPart;
|
||||||
import net.minecraft.state.properties.BellAttachment;
|
import net.minecraft.state.properties.BellAttachment;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.state.properties.DoubleBlockHalf;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockMovementTraits {
|
public class BlockMovementChecks {
|
||||||
|
|
||||||
public static boolean movementNecessary(BlockState state, World world, BlockPos pos) {
|
private static final List<MovementNecessaryCheck> MOVEMENT_NECESSARY_CHECKS = new ArrayList<>();
|
||||||
|
private static final List<MovementAllowedCheck> MOVEMENT_ALLOWED_CHECKS = new ArrayList<>();
|
||||||
|
private static final List<BrittleCheck> BRITTLE_CHECKS = new ArrayList<>();
|
||||||
|
private static final List<AttachedCheck> ATTACHED_CHECKS = new ArrayList<>();
|
||||||
|
private static final List<NotSupportiveCheck> NOT_SUPPORTIVE_CHECKS = new ArrayList<>();
|
||||||
|
|
||||||
|
// Registration
|
||||||
|
// Add new checks to the front instead of the end
|
||||||
|
|
||||||
|
public static void registerMovementNecessaryCheck(MovementNecessaryCheck check) {
|
||||||
|
MOVEMENT_NECESSARY_CHECKS.add(0, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerMovementAllowedCheck(MovementAllowedCheck check) {
|
||||||
|
MOVEMENT_ALLOWED_CHECKS.add(0, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerBrittleCheck(BrittleCheck check) {
|
||||||
|
BRITTLE_CHECKS.add(0, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerAttachedCheck(AttachedCheck check) {
|
||||||
|
ATTACHED_CHECKS.add(0, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerNotSupportiveCheck(NotSupportiveCheck check) {
|
||||||
|
NOT_SUPPORTIVE_CHECKS.add(0, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerAllChecks(AllChecks checks) {
|
||||||
|
registerMovementNecessaryCheck(checks);
|
||||||
|
registerMovementAllowedCheck(checks);
|
||||||
|
registerBrittleCheck(checks);
|
||||||
|
registerAttachedCheck(checks);
|
||||||
|
registerNotSupportiveCheck(checks);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actual check methods
|
||||||
|
|
||||||
|
public static boolean isMovementNecessary(BlockState state, World world, BlockPos pos) {
|
||||||
|
for (MovementNecessaryCheck check : MOVEMENT_NECESSARY_CHECKS) {
|
||||||
|
CheckResult result = check.isMovementNecessary(state, world, pos);
|
||||||
|
if (result != CheckResult.PASS) {
|
||||||
|
return result.toBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isMovementNecessaryFallback(state, world, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isMovementAllowed(BlockState state, World world, BlockPos pos) {
|
||||||
|
for (MovementAllowedCheck check : MOVEMENT_ALLOWED_CHECKS) {
|
||||||
|
CheckResult result = check.isMovementAllowed(state, world, pos);
|
||||||
|
if (result != CheckResult.PASS) {
|
||||||
|
return result.toBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isMovementAllowedFallback(state, world, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Brittle blocks will be collected first, as they may break when other blocks
|
||||||
|
* are removed before them
|
||||||
|
*/
|
||||||
|
public static boolean isBrittle(BlockState state) {
|
||||||
|
for (BrittleCheck check : BRITTLE_CHECKS) {
|
||||||
|
CheckResult result = check.isBrittle(state);
|
||||||
|
if (result != CheckResult.PASS) {
|
||||||
|
return result.toBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isBrittleFallback(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attached blocks will move if blocks they are attached to are moved
|
||||||
|
*/
|
||||||
|
public static boolean isBlockAttachedTowards(BlockState state, World world, BlockPos pos,
|
||||||
|
Direction direction) {
|
||||||
|
for (AttachedCheck check : ATTACHED_CHECKS) {
|
||||||
|
CheckResult result = check.isBlockAttachedTowards(state, world, pos, direction);
|
||||||
|
if (result != CheckResult.PASS) {
|
||||||
|
return result.toBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isBlockAttachedTowardsFallback(state, world, pos, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Non-Supportive blocks will not continue a chain of blocks picked up by e.g. a
|
||||||
|
* piston
|
||||||
|
*/
|
||||||
|
public static boolean isNotSupportive(BlockState state, Direction facing) {
|
||||||
|
for (NotSupportiveCheck check : NOT_SUPPORTIVE_CHECKS) {
|
||||||
|
CheckResult result = check.isNotSupportive(state, facing);
|
||||||
|
if (result != CheckResult.PASS) {
|
||||||
|
return result.toBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isNotSupportiveFallback(state, facing);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback checks
|
||||||
|
|
||||||
|
private static boolean isMovementNecessaryFallback(BlockState state, World world, BlockPos pos) {
|
||||||
if (isBrittle(state))
|
if (isBrittle(state))
|
||||||
return true;
|
return true;
|
||||||
if (state.getBlock() instanceof FenceGateBlock)
|
if (state.getBlock() instanceof FenceGateBlock)
|
||||||
return true;
|
return true;
|
||||||
if (state.getMaterial()
|
if (state.getMaterial()
|
||||||
.isReplaceable())
|
.isReplaceable())
|
||||||
return false;
|
return false;
|
||||||
if (state.getCollisionShape(world, pos)
|
if (state.getCollisionShape(world, pos)
|
||||||
.isEmpty())
|
.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean movementAllowed(BlockState state, World world, BlockPos pos) {
|
private static boolean isMovementAllowedFallback(BlockState state, World world, BlockPos pos) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (block instanceof AbstractChassisBlock)
|
if (block instanceof AbstractChassisBlock)
|
||||||
return true;
|
return true;
|
||||||
|
@ -115,11 +221,7 @@ public class BlockMovementTraits {
|
||||||
return state.getPushReaction() != PushReaction.BLOCK;
|
return state.getPushReaction() != PushReaction.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static boolean isBrittleFallback(BlockState state) {
|
||||||
* Brittle blocks will be collected first, as they may break when other blocks
|
|
||||||
* are removed before them
|
|
||||||
*/
|
|
||||||
public static boolean isBrittle(BlockState state) {
|
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (state.contains(BlockStateProperties.HANGING))
|
if (state.contains(BlockStateProperties.HANGING))
|
||||||
return true;
|
return true;
|
||||||
|
@ -147,11 +249,8 @@ public class BlockMovementTraits {
|
||||||
return AllBlockTags.BRITTLE.tag.contains(block);
|
return AllBlockTags.BRITTLE.tag.contains(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static boolean isBlockAttachedTowardsFallback(BlockState state, World world, BlockPos pos,
|
||||||
* Attached blocks will move if blocks they are attached to are moved
|
Direction direction) {
|
||||||
*/
|
|
||||||
public static boolean isBlockAttachedTowards(IBlockReader world, BlockPos pos, BlockState state,
|
|
||||||
Direction direction) {
|
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (block instanceof LadderBlock)
|
if (block instanceof LadderBlock)
|
||||||
return state.get(LadderBlock.FACING) == direction.getOpposite();
|
return state.get(LadderBlock.FACING) == direction.getOpposite();
|
||||||
|
@ -163,13 +262,15 @@ public class BlockMovementTraits {
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
if (block instanceof AbstractPressurePlateBlock)
|
if (block instanceof AbstractPressurePlateBlock)
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
if (block instanceof DoorBlock)
|
if (block instanceof DoorBlock) {
|
||||||
|
if (state.get(DoorBlock.HALF) == DoubleBlockHalf.LOWER && direction == Direction.UP)
|
||||||
|
return true;
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
|
}
|
||||||
if (block instanceof BedBlock) {
|
if (block instanceof BedBlock) {
|
||||||
Direction facing = state.get(BedBlock.HORIZONTAL_FACING);
|
Direction facing = state.get(BedBlock.HORIZONTAL_FACING);
|
||||||
if (state.get(BedBlock.PART) == BedPart.HEAD) {
|
if (state.get(BedBlock.PART) == BedPart.HEAD)
|
||||||
facing = facing.getOpposite();
|
facing = facing.getOpposite();
|
||||||
}
|
|
||||||
return direction == facing;
|
return direction == facing;
|
||||||
}
|
}
|
||||||
if (block instanceof RedstoneLinkBlock)
|
if (block instanceof RedstoneLinkBlock)
|
||||||
|
@ -221,21 +322,17 @@ public class BlockMovementTraits {
|
||||||
}
|
}
|
||||||
if (state.getBlock() instanceof SailBlock)
|
if (state.getBlock() instanceof SailBlock)
|
||||||
return direction.getAxis() != state.get(SailBlock.FACING)
|
return direction.getAxis() != state.get(SailBlock.FACING)
|
||||||
.getAxis();
|
.getAxis();
|
||||||
if (state.getBlock() instanceof FluidTankBlock)
|
if (state.getBlock() instanceof FluidTankBlock)
|
||||||
return FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(direction));
|
return FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(direction));
|
||||||
if (AllBlocks.STICKER.has(state) && state.get(StickerBlock.EXTENDED)) {
|
if (AllBlocks.STICKER.has(state) && state.get(StickerBlock.EXTENDED)) {
|
||||||
return direction == state.get(StickerBlock.FACING)
|
return direction == state.get(StickerBlock.FACING)
|
||||||
&& !notSupportive(world.getBlockState(pos.offset(direction)), direction.getOpposite());
|
&& !isNotSupportive(world.getBlockState(pos.offset(direction)), direction.getOpposite());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static boolean isNotSupportiveFallback(BlockState state, Direction facing) {
|
||||||
* Non-Supportive blocks will not continue a chain of blocks picked up by e.g. a
|
|
||||||
* piston
|
|
||||||
*/
|
|
||||||
public static boolean notSupportive(BlockState state, Direction facing) {
|
|
||||||
if (AllBlocks.MECHANICAL_DRILL.has(state))
|
if (AllBlocks.MECHANICAL_DRILL.has(state))
|
||||||
return state.get(BlockStateProperties.FACING) == facing;
|
return state.get(BlockStateProperties.FACING) == facing;
|
||||||
if (AllBlocks.MECHANICAL_BEARING.has(state))
|
if (AllBlocks.MECHANICAL_BEARING.has(state))
|
||||||
|
@ -257,13 +354,67 @@ public class BlockMovementTraits {
|
||||||
.getAxis();
|
.getAxis();
|
||||||
if (AllBlocks.PISTON_EXTENSION_POLE.has(state))
|
if (AllBlocks.PISTON_EXTENSION_POLE.has(state))
|
||||||
return facing.getAxis() != state.get(BlockStateProperties.FACING)
|
return facing.getAxis() != state.get(BlockStateProperties.FACING)
|
||||||
.getAxis();
|
.getAxis();
|
||||||
if (AllBlocks.MECHANICAL_PISTON_HEAD.has(state))
|
if (AllBlocks.MECHANICAL_PISTON_HEAD.has(state))
|
||||||
return facing.getAxis() != state.get(BlockStateProperties.FACING)
|
return facing.getAxis() != state.get(BlockStateProperties.FACING)
|
||||||
.getAxis();
|
.getAxis();
|
||||||
if (AllBlocks.STICKER.has(state) && !state.get(StickerBlock.EXTENDED))
|
if (AllBlocks.STICKER.has(state) && !state.get(StickerBlock.EXTENDED))
|
||||||
return facing == state.get(StickerBlock.FACING);
|
return facing == state.get(StickerBlock.FACING);
|
||||||
return isBrittle(state);
|
return isBrittle(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check classes
|
||||||
|
|
||||||
|
public static interface MovementNecessaryCheck {
|
||||||
|
public CheckResult isMovementNecessary(BlockState state, World world, BlockPos pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MovementAllowedCheck {
|
||||||
|
public CheckResult isMovementAllowed(BlockState state, World world, BlockPos pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface BrittleCheck {
|
||||||
|
/**
|
||||||
|
* Brittle blocks will be collected first, as they may break when other blocks
|
||||||
|
* are removed before them
|
||||||
|
*/
|
||||||
|
public CheckResult isBrittle(BlockState state);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface AttachedCheck {
|
||||||
|
/**
|
||||||
|
* Attached blocks will move if blocks they are attached to are moved
|
||||||
|
*/
|
||||||
|
public CheckResult isBlockAttachedTowards(BlockState state, World world, BlockPos pos, Direction direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface NotSupportiveCheck {
|
||||||
|
/**
|
||||||
|
* Non-Supportive blocks will not continue a chain of blocks picked up by e.g. a
|
||||||
|
* piston
|
||||||
|
*/
|
||||||
|
public CheckResult isNotSupportive(BlockState state, Direction direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface AllChecks extends MovementNecessaryCheck, MovementAllowedCheck, BrittleCheck, AttachedCheck, NotSupportiveCheck {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum CheckResult {
|
||||||
|
SUCCESS,
|
||||||
|
FAIL,
|
||||||
|
PASS;
|
||||||
|
|
||||||
|
public Boolean toBoolean() {
|
||||||
|
return this == PASS ? null : (this == SUCCESS ? true : false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult of(boolean b) {
|
||||||
|
return b ? SUCCESS : FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult of(Boolean b) {
|
||||||
|
return b == null ? PASS : (b ? SUCCESS : FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -61,7 +61,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.BlockFace;
|
import com.simibubi.create.foundation.utility.BlockFace;
|
||||||
import com.simibubi.create.foundation.utility.Coordinate;
|
import com.simibubi.create.foundation.utility.ICoordinate;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
import com.simibubi.create.foundation.utility.NBTProcessors;
|
import com.simibubi.create.foundation.utility.NBTProcessors;
|
||||||
|
@ -73,7 +73,6 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.ChestBlock;
|
import net.minecraft.block.ChestBlock;
|
||||||
import net.minecraft.block.DoorBlock;
|
|
||||||
import net.minecraft.block.IWaterLoggable;
|
import net.minecraft.block.IWaterLoggable;
|
||||||
import net.minecraft.block.PressurePlateBlock;
|
import net.minecraft.block.PressurePlateBlock;
|
||||||
import net.minecraft.block.material.PushReaction;
|
import net.minecraft.block.material.PushReaction;
|
||||||
|
@ -87,7 +86,6 @@ import net.minecraft.nbt.ListNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.state.properties.ChestType;
|
import net.minecraft.state.properties.ChestType;
|
||||||
import net.minecraft.state.properties.DoubleBlockHalf;
|
|
||||||
import net.minecraft.state.properties.PistonType;
|
import net.minecraft.state.properties.PistonType;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -212,7 +210,7 @@ public abstract class Contraption {
|
||||||
if (bounds == null)
|
if (bounds == null)
|
||||||
bounds = new AxisAlignedBB(BlockPos.ZERO);
|
bounds = new AxisAlignedBB(BlockPos.ZERO);
|
||||||
|
|
||||||
if (!BlockMovementTraits.isBrittle(world.getBlockState(pos)))
|
if (!BlockMovementChecks.isBrittle(world.getBlockState(pos)))
|
||||||
frontier.add(pos);
|
frontier.add(pos);
|
||||||
if (!addToInitialFrontier(world, pos, forcedDirection, frontier))
|
if (!addToInitialFrontier(world, pos, forcedDirection, frontier))
|
||||||
return false;
|
return false;
|
||||||
|
@ -312,12 +310,12 @@ public abstract class Contraption {
|
||||||
if (isAnchoringBlockAt(pos))
|
if (isAnchoringBlockAt(pos))
|
||||||
return true;
|
return true;
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (!BlockMovementTraits.movementNecessary(state, world, pos))
|
if (!BlockMovementChecks.isMovementNecessary(state, world, pos))
|
||||||
return true;
|
return true;
|
||||||
if (!movementAllowed(state, world, pos))
|
if (!movementAllowed(state, world, pos))
|
||||||
throw AssemblyException.unmovableBlock(pos, state);
|
throw AssemblyException.unmovableBlock(pos, state);
|
||||||
if (state.getBlock() instanceof AbstractChassisBlock
|
if (state.getBlock() instanceof AbstractChassisBlock
|
||||||
&& !moveChassis(world, pos, forcedDirection, frontier, visited))
|
&& !moveChassis(world, pos, forcedDirection, frontier, visited))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (AllBlocks.ADJUSTABLE_CRATE.has(state))
|
if (AllBlocks.ADJUSTABLE_CRATE.has(state))
|
||||||
|
@ -336,14 +334,14 @@ public abstract class Contraption {
|
||||||
Direction offset = state.get(StickerBlock.FACING);
|
Direction offset = state.get(StickerBlock.FACING);
|
||||||
BlockPos attached = pos.offset(offset);
|
BlockPos attached = pos.offset(offset);
|
||||||
if (!visited.contains(attached)
|
if (!visited.contains(attached)
|
||||||
&& !BlockMovementTraits.notSupportive(world.getBlockState(attached), offset.getOpposite()))
|
&& !BlockMovementChecks.isNotSupportive(world.getBlockState(attached), offset.getOpposite()))
|
||||||
frontier.add(attached);
|
frontier.add(attached);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bearings potentially create stabilized sub-contraptions
|
// Bearings potentially create stabilized sub-contraptions
|
||||||
if (AllBlocks.MECHANICAL_BEARING.has(state))
|
if (AllBlocks.MECHANICAL_BEARING.has(state))
|
||||||
moveBearing(pos, frontier, visited, state);
|
moveBearing(pos, frontier, visited, state);
|
||||||
|
|
||||||
// WM Bearings attach their structure when moved
|
// WM Bearings attach their structure when moved
|
||||||
if (AllBlocks.WINDMILL_BEARING.has(state))
|
if (AllBlocks.WINDMILL_BEARING.has(state))
|
||||||
moveWindmillBearing(pos, frontier, visited, state);
|
moveWindmillBearing(pos, frontier, visited, state);
|
||||||
|
@ -365,13 +363,6 @@ public abstract class Contraption {
|
||||||
if (isPistonHead(state))
|
if (isPistonHead(state))
|
||||||
movePistonHead(world, pos, frontier, visited, state);
|
movePistonHead(world, pos, frontier, visited, state);
|
||||||
|
|
||||||
// Doors try to stay whole
|
|
||||||
if (state.getBlock() instanceof DoorBlock) {
|
|
||||||
BlockPos otherPartPos = pos.up(state.get(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? 1 : -1);
|
|
||||||
if (!visited.contains(otherPartPos))
|
|
||||||
frontier.add(otherPartPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cart assemblers attach themselves
|
// Cart assemblers attach themselves
|
||||||
BlockPos posDown = pos.down();
|
BlockPos posDown = pos.down();
|
||||||
BlockState stateBelow = world.getBlockState(posDown);
|
BlockState stateBelow = world.getBlockState(posDown);
|
||||||
|
@ -395,24 +386,24 @@ public abstract class Contraption {
|
||||||
boolean wasVisited = visited.contains(offsetPos);
|
boolean wasVisited = visited.contains(offsetPos);
|
||||||
boolean faceHasGlue = superglue.containsKey(offset);
|
boolean faceHasGlue = superglue.containsKey(offset);
|
||||||
boolean blockAttachedTowardsFace =
|
boolean blockAttachedTowardsFace =
|
||||||
BlockMovementTraits.isBlockAttachedTowards(world, offsetPos, blockState, offset.getOpposite());
|
BlockMovementChecks.isBlockAttachedTowards(blockState, world, offsetPos, offset.getOpposite());
|
||||||
boolean brittle = BlockMovementTraits.isBrittle(blockState);
|
boolean brittle = BlockMovementChecks.isBrittle(blockState);
|
||||||
boolean canStick = !brittle && state.canStickTo(blockState) && blockState.canStickTo(state);
|
boolean canStick = !brittle && state.canStickTo(blockState) && blockState.canStickTo(state);
|
||||||
if (canStick) {
|
if (canStick) {
|
||||||
if (state.getPushReaction() == PushReaction.PUSH_ONLY
|
if (state.getPushReaction() == PushReaction.PUSH_ONLY
|
||||||
|| blockState.getPushReaction() == PushReaction.PUSH_ONLY) {
|
|| blockState.getPushReaction() == PushReaction.PUSH_ONLY) {
|
||||||
canStick = false;
|
canStick = false;
|
||||||
}
|
}
|
||||||
if (BlockMovementTraits.notSupportive(state, offset)) {
|
if (BlockMovementChecks.isNotSupportive(state, offset)) {
|
||||||
canStick = false;
|
canStick = false;
|
||||||
}
|
}
|
||||||
if (BlockMovementTraits.notSupportive(blockState, offset.getOpposite())) {
|
if (BlockMovementChecks.isNotSupportive(blockState, offset.getOpposite())) {
|
||||||
canStick = false;
|
canStick = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasVisited && (canStick || blockAttachedTowardsFace || faceHasGlue
|
if (!wasVisited && (canStick || blockAttachedTowardsFace || faceHasGlue
|
||||||
|| (offset == forcedDirection && !BlockMovementTraits.notSupportive(state, forcedDirection))))
|
|| (offset == forcedDirection && !BlockMovementChecks.isNotSupportive(state, forcedDirection))))
|
||||||
frontier.add(offsetPos);
|
frontier.add(offsetPos);
|
||||||
if (faceHasGlue)
|
if (faceHasGlue)
|
||||||
addGlue(superglue.get(offset));
|
addGlue(superglue.get(offset));
|
||||||
|
@ -674,7 +665,7 @@ public abstract class Contraption {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean movementAllowed(BlockState state, World world, BlockPos pos) {
|
protected boolean movementAllowed(BlockState state, World world, BlockPos pos) {
|
||||||
return BlockMovementTraits.movementAllowed(state, world, pos);
|
return BlockMovementChecks.isMovementAllowed(state, world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAnchoringBlockAt(BlockPos pos) {
|
protected boolean isAnchoringBlockAt(BlockPos pos) {
|
||||||
|
@ -944,11 +935,11 @@ public abstract class Contraption {
|
||||||
for (Iterator<BlockInfo> iterator = blocks.values()
|
for (Iterator<BlockInfo> iterator = blocks.values()
|
||||||
.iterator(); iterator.hasNext();) {
|
.iterator(); iterator.hasNext();) {
|
||||||
BlockInfo block = iterator.next();
|
BlockInfo block = iterator.next();
|
||||||
if (brittles != BlockMovementTraits.isBrittle(block.state))
|
if (brittles != BlockMovementChecks.isBrittle(block.state))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BlockPos add = block.pos.add(anchor)
|
BlockPos add = block.pos.add(anchor)
|
||||||
.add(offset);
|
.add(offset);
|
||||||
if (customBlockRemoval(world, add, block.state))
|
if (customBlockRemoval(world, add, block.state))
|
||||||
continue;
|
continue;
|
||||||
BlockState oldState = world.getBlockState(add);
|
BlockState oldState = world.getBlockState(add);
|
||||||
|
@ -974,17 +965,14 @@ public abstract class Contraption {
|
||||||
// continue;
|
// continue;
|
||||||
int flags = BlockFlags.IS_MOVING | BlockFlags.DEFAULT;
|
int flags = BlockFlags.IS_MOVING | BlockFlags.DEFAULT;
|
||||||
world.notifyBlockUpdate(add, block.state, Blocks.AIR.getDefaultState(), flags);
|
world.notifyBlockUpdate(add, block.state, Blocks.AIR.getDefaultState(), flags);
|
||||||
world.markAndNotifyBlock(add, world.getChunkAt(add), block.state, Blocks.AIR.getDefaultState(), flags, 512);
|
|
||||||
block.state.updateDiagonalNeighbors(world, add, flags & -2);
|
block.state.updateDiagonalNeighbors(world, add, flags & -2);
|
||||||
// world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(),
|
|
||||||
// BlockFlags.IS_MOVING | BlockFlags.DEFAULT); this method did strange logspamming with POI-related blocks
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBlocksToWorld(World world, StructureTransform transform) {
|
public void addBlocksToWorld(World world, StructureTransform transform) {
|
||||||
for (boolean nonBrittles : Iterate.trueAndFalse) {
|
for (boolean nonBrittles : Iterate.trueAndFalse) {
|
||||||
for (BlockInfo block : blocks.values()) {
|
for (BlockInfo block : blocks.values()) {
|
||||||
if (nonBrittles == BlockMovementTraits.isBrittle(block.state))
|
if (nonBrittles == BlockMovementChecks.isBrittle(block.state))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BlockPos targetPos = transform.apply(block.pos);
|
BlockPos targetPos = transform.apply(block.pos);
|
||||||
|
@ -1226,16 +1214,16 @@ public abstract class Contraption {
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case X:
|
case X:
|
||||||
return getMaxDistSqr(blocks, BlockPos::getY, BlockPos::getZ);
|
return getMaxDistSqr(blocks, BlockPos::getY, BlockPos::getZ);
|
||||||
case Y:
|
case Y:
|
||||||
return getMaxDistSqr(blocks, BlockPos::getX, BlockPos::getZ);
|
return getMaxDistSqr(blocks, BlockPos::getX, BlockPos::getZ);
|
||||||
case Z:
|
case Z:
|
||||||
return getMaxDistSqr(blocks, BlockPos::getX, BlockPos::getY);
|
return getMaxDistSqr(blocks, BlockPos::getX, BlockPos::getY);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalStateException("Impossible axis");
|
throw new IllegalStateException("Impossible axis");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getMaxDistSqr(Set<BlockPos> blocks, Coordinate one, Coordinate other) {
|
public static float getMaxDistSqr(Set<BlockPos> blocks, ICoordinate one, ICoordinate other) {
|
||||||
float maxDistSq = -1;
|
float maxDistSq = -1;
|
||||||
for (BlockPos pos : blocks) {
|
for (BlockPos pos : blocks) {
|
||||||
float a = one.get(pos);
|
float a = one.get(pos);
|
||||||
|
|
|
@ -35,11 +35,11 @@ public class ChassisRangeDisplay {
|
||||||
public Entry(ChassisTileEntity te) {
|
public Entry(ChassisTileEntity te) {
|
||||||
this.te = te;
|
this.te = te;
|
||||||
timer = DISPLAY_TIME;
|
timer = DISPLAY_TIME;
|
||||||
CreateClient.outliner.showCluster(getOutlineKey(), createSelection(te))
|
CreateClient.OUTLINER.showCluster(getOutlineKey(), createSelection(te))
|
||||||
.colored(0xFFFFFF)
|
.colored(0xFFFFFF)
|
||||||
.disableNormals()
|
.disableNormals()
|
||||||
.lineWidth(1 / 16f)
|
.lineWidth(1 / 16f)
|
||||||
.withFaceTexture(AllSpecialTextures.HIGHLIGHT_CHECKERED);
|
.withFaceTexture(AllSpecialTextures.HIGHLIGHT_CHECKERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object getOutlineKey() {
|
protected Object getOutlineKey() {
|
||||||
|
@ -97,7 +97,7 @@ public class ChassisRangeDisplay {
|
||||||
Entry entry = entries.get(pos);
|
Entry entry = entries.get(pos);
|
||||||
if (tickEntry(entry, hasWrench))
|
if (tickEntry(entry, hasWrench))
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
CreateClient.outliner.keep(entry.getOutlineKey());
|
CreateClient.OUTLINER.keep(entry.getOutlineKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator<GroupEntry> iterator = groupEntries.iterator(); iterator.hasNext();) {
|
for (Iterator<GroupEntry> iterator = groupEntries.iterator(); iterator.hasNext();) {
|
||||||
|
@ -107,7 +107,7 @@ public class ChassisRangeDisplay {
|
||||||
if (group == lastHoveredGroup)
|
if (group == lastHoveredGroup)
|
||||||
lastHoveredGroup = null;
|
lastHoveredGroup = null;
|
||||||
}
|
}
|
||||||
CreateClient.outliner.keep(group.getOutlineKey());
|
CreateClient.OUTLINER.keep(group.getOutlineKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasWrench)
|
if (!hasWrench)
|
||||||
|
@ -173,9 +173,9 @@ public class ChassisRangeDisplay {
|
||||||
GroupEntry hoveredGroup = new GroupEntry(chassis);
|
GroupEntry hoveredGroup = new GroupEntry(chassis);
|
||||||
|
|
||||||
for (ChassisTileEntity included : hoveredGroup.includedTEs)
|
for (ChassisTileEntity included : hoveredGroup.includedTEs)
|
||||||
CreateClient.outliner.remove(included.getPos());
|
CreateClient.OUTLINER.remove(included.getPos());
|
||||||
|
|
||||||
groupEntries.forEach(entry -> CreateClient.outliner.remove(entry.getOutlineKey()));
|
groupEntries.forEach(entry -> CreateClient.OUTLINER.remove(entry.getOutlineKey()));
|
||||||
groupEntries.clear();
|
groupEntries.clear();
|
||||||
entries.clear();
|
entries.clear();
|
||||||
groupEntries.add(hoveredGroup);
|
groupEntries.add(hoveredGroup);
|
||||||
|
@ -186,7 +186,7 @@ public class ChassisRangeDisplay {
|
||||||
BlockPos pos = chassis.getPos();
|
BlockPos pos = chassis.getPos();
|
||||||
GroupEntry entry = getExistingGroupForPos(pos);
|
GroupEntry entry = getExistingGroupForPos(pos);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
CreateClient.outliner.remove(entry.getOutlineKey());
|
CreateClient.OUTLINER.remove(entry.getOutlineKey());
|
||||||
|
|
||||||
groupEntries.clear();
|
groupEntries.clear();
|
||||||
entries.clear();
|
entries.clear();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Queue;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits;
|
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
|
@ -165,14 +165,14 @@ public class ChassisTileEntity extends SmartTileEntity {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Ignore replaceable Blocks and Air-like
|
// Ignore replaceable Blocks and Air-like
|
||||||
if (!BlockMovementTraits.movementNecessary(currentState, world, current))
|
if (!BlockMovementChecks.isMovementNecessary(currentState, world, current))
|
||||||
break;
|
break;
|
||||||
if (BlockMovementTraits.isBrittle(currentState))
|
if (BlockMovementChecks.isBrittle(currentState))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
positions.add(current);
|
positions.add(current);
|
||||||
|
|
||||||
if (BlockMovementTraits.notSupportive(currentState, facing))
|
if (BlockMovementChecks.isNotSupportive(currentState, facing))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,9 +206,9 @@ public class ChassisTileEntity extends SmartTileEntity {
|
||||||
continue;
|
continue;
|
||||||
if (!searchPos.withinDistance(pos, chassisRange + .5f))
|
if (!searchPos.withinDistance(pos, chassisRange + .5f))
|
||||||
continue;
|
continue;
|
||||||
if (!BlockMovementTraits.movementNecessary(searchedState, world, searchPos))
|
if (!BlockMovementChecks.isMovementNecessary(searchedState, world, searchPos))
|
||||||
continue;
|
continue;
|
||||||
if (BlockMovementTraits.isBrittle(searchedState))
|
if (BlockMovementChecks.isBrittle(searchedState))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
localVisited.add(searchPos);
|
localVisited.add(searchPos);
|
||||||
|
@ -220,7 +220,7 @@ public class ChassisTileEntity extends SmartTileEntity {
|
||||||
continue;
|
continue;
|
||||||
if (searchPos.equals(pos) && offset != facing)
|
if (searchPos.equals(pos) && offset != facing)
|
||||||
continue;
|
continue;
|
||||||
if (BlockMovementTraits.notSupportive(searchedState, offset))
|
if (BlockMovementChecks.isNotSupportive(searchedState, offset))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
localFrontier.add(searchPos.offset(offset));
|
localFrontier.add(searchPos.offset(offset));
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.simibubi.create.AllEntityTypes;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits;
|
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingBlock;
|
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingBlock;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock;
|
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock;
|
||||||
import com.simibubi.create.content.schematics.ISpecialEntityItemRequirement;
|
import com.simibubi.create.content.schematics.ISpecialEntityItemRequirement;
|
||||||
|
@ -195,11 +195,11 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
public static boolean isValidFace(World world, BlockPos pos, Direction direction) {
|
public static boolean isValidFace(World world, BlockPos pos, Direction direction) {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (BlockMovementTraits.isBlockAttachedTowards(world, pos, state, direction))
|
if (BlockMovementChecks.isBlockAttachedTowards(state, world, pos, direction))
|
||||||
return true;
|
return true;
|
||||||
if (!BlockMovementTraits.movementNecessary(state, world, pos))
|
if (!BlockMovementChecks.isMovementNecessary(state, world, pos))
|
||||||
return false;
|
return false;
|
||||||
if (BlockMovementTraits.notSupportive(state, direction))
|
if (BlockMovementChecks.isNotSupportive(state, direction))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
ArrayList<ItemStack> reuiredItems = new ArrayList<>();
|
ArrayList<ItemStack> reuiredItems = new ArrayList<>();
|
||||||
reuiredItems.add(new ItemStack(getRailItem(state)));
|
reuiredItems.add(new ItemStack(getRailItem(state)));
|
||||||
reuiredItems.add(new ItemStack(asItem()));
|
reuiredItems.add(new ItemStack(asItem()));
|
||||||
|
|
|
@ -288,6 +288,11 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onLengthBroken() {
|
||||||
|
offset = 0;
|
||||||
|
sendData();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return !isRemoved();
|
return !isRemoved();
|
||||||
|
@ -311,4 +316,4 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
||||||
public BlockPos getBlockPosition() {
|
public BlockPos getBlockPosition() {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Queue;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits;
|
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption;
|
import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption;
|
||||||
|
@ -169,13 +169,13 @@ public class PistonContraption extends TranslatingContraption {
|
||||||
if (!world.isBlockPresent(currentPos))
|
if (!world.isBlockPresent(currentPos))
|
||||||
throw AssemblyException.unloadedChunk(currentPos);
|
throw AssemblyException.unloadedChunk(currentPos);
|
||||||
BlockState state = world.getBlockState(currentPos);
|
BlockState state = world.getBlockState(currentPos);
|
||||||
if (!BlockMovementTraits.movementNecessary(state, world, currentPos))
|
if (!BlockMovementChecks.isMovementNecessary(state, world, currentPos))
|
||||||
return true;
|
return true;
|
||||||
if (BlockMovementTraits.isBrittle(state) && !(state.getBlock() instanceof CarpetBlock))
|
if (BlockMovementChecks.isBrittle(state) && !(state.getBlock() instanceof CarpetBlock))
|
||||||
return true;
|
return true;
|
||||||
if (isPistonHead(state) && state.get(FACING) == direction.getOpposite())
|
if (isPistonHead(state) && state.get(FACING) == direction.getOpposite())
|
||||||
return true;
|
return true;
|
||||||
if (!BlockMovementTraits.movementAllowed(state, world, currentPos))
|
if (!BlockMovementChecks.isMovementAllowed(state, world, currentPos))
|
||||||
if (retracting)
|
if (retracting)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
|
@ -183,7 +183,7 @@ public class PistonContraption extends TranslatingContraption {
|
||||||
if (retracting && state.getPushReaction() == PushReaction.PUSH_ONLY)
|
if (retracting && state.getPushReaction() == PushReaction.PUSH_ONLY)
|
||||||
return true;
|
return true;
|
||||||
frontier.add(currentPos);
|
frontier.add(currentPos);
|
||||||
if (BlockMovementTraits.notSupportive(state, orientation))
|
if (BlockMovementChecks.isNotSupportive(state, orientation))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.pathfinding.PathType;
|
import net.minecraft.pathfinding.PathType;
|
||||||
import net.minecraft.state.StateContainer.Builder;
|
import net.minecraft.state.StateContainer.Builder;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -71,7 +72,7 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
||||||
public boolean isToolEffective(BlockState state, ToolType tool) {
|
public boolean isToolEffective(BlockState state, ToolType tool) {
|
||||||
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PushReaction getPushReaction(BlockState state) {
|
public PushReaction getPushReaction(BlockState state) {
|
||||||
return PushReaction.NORMAL;
|
return PushReaction.NORMAL;
|
||||||
|
@ -113,10 +114,17 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
||||||
|
|
||||||
final BlockPos basePos = pistonBase;
|
final BlockPos basePos = pistonBase;
|
||||||
BlockPos.getAllInBox(pistonBase, pistonHead)
|
BlockPos.getAllInBox(pistonBase, pistonHead)
|
||||||
.filter(p -> !p.equals(pos) && !p.equals(basePos))
|
.filter(p -> !p.equals(pos) && !p.equals(basePos))
|
||||||
.forEach(p -> worldIn.destroyBlock(p, !player.isCreative()));
|
.forEach(p -> worldIn.destroyBlock(p, !player.isCreative()));
|
||||||
worldIn.setBlockState(basePos, worldIn.getBlockState(basePos)
|
worldIn.setBlockState(basePos, worldIn.getBlockState(basePos)
|
||||||
.with(MechanicalPistonBlock.STATE, PistonState.RETRACTED));
|
.with(MechanicalPistonBlock.STATE, PistonState.RETRACTED));
|
||||||
|
|
||||||
|
TileEntity te = worldIn.getTileEntity(basePos);
|
||||||
|
if (te instanceof MechanicalPistonTileEntity) {
|
||||||
|
MechanicalPistonTileEntity baseTE = (MechanicalPistonTileEntity) te;
|
||||||
|
baseTE.offset = 0;
|
||||||
|
baseTE.onLengthBroken();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockHarvested(worldIn, pos, state, player);
|
super.onBlockHarvested(worldIn, pos, state, player);
|
||||||
|
@ -168,8 +176,8 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,13 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void onRopeBroken(World world, BlockPos pulleyPos) {
|
private static void onRopeBroken(World world, BlockPos pulleyPos) {
|
||||||
TileEntity te = world.getTileEntity(pulleyPos);
|
TileEntity te = world.getTileEntity(pulleyPos);
|
||||||
if (!(te instanceof PulleyTileEntity))
|
if (te instanceof PulleyTileEntity) {
|
||||||
return;
|
PulleyTileEntity pulley = (PulleyTileEntity) te;
|
||||||
PulleyTileEntity pulley = (PulleyTileEntity) te;
|
pulley.initialOffset = 0;
|
||||||
pulley.offset = 0;
|
pulley.onLengthBroken();
|
||||||
pulley.sendData();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
@ -98,8 +98,8 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
||||||
super(properties);
|
super(properties);
|
||||||
setDefaultState(super.getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
|
setDefaultState(super.getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,12 @@ public class PulleyRenderer extends AbstractPulleyRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer renderRope(KineticTileEntity te) {
|
protected SuperByteBuffer renderRope(KineticTileEntity te) {
|
||||||
return CreateClient.bufferCache.renderBlock(AllBlocks.ROPE.getDefaultState());
|
return CreateClient.BUFFER_CACHE.renderBlock(AllBlocks.ROPE.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer renderMagnet(KineticTileEntity te) {
|
protected SuperByteBuffer renderMagnet(KineticTileEntity te) {
|
||||||
return CreateClient.bufferCache.renderBlock(AllBlocks.PULLEY_MAGNET.getDefaultState());
|
return CreateClient.BUFFER_CACHE.renderBlock(AllBlocks.PULLEY_MAGNET.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pu
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits;
|
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionCollider;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionCollider;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.LinearActuatorTileEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.piston.LinearActuatorTileEntity;
|
||||||
|
@ -186,9 +186,9 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
||||||
|
|
||||||
BlockPos posBelow = pos.down((int) (offset + getMovementSpeed()) + 1);
|
BlockPos posBelow = pos.down((int) (offset + getMovementSpeed()) + 1);
|
||||||
BlockState state = world.getBlockState(posBelow);
|
BlockState state = world.getBlockState(posBelow);
|
||||||
if (!BlockMovementTraits.movementNecessary(state, world, posBelow))
|
if (!BlockMovementChecks.isMovementNecessary(state, world, posBelow))
|
||||||
return;
|
return;
|
||||||
if (BlockMovementTraits.isBrittle(state))
|
if (BlockMovementChecks.isBrittle(state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disassemble();
|
disassemble();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement.render;
|
package com.simibubi.create.content.contraptions.components.structureMovement.render;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_QUADS;
|
import static org.lwjgl.opengl.GL13.GL_QUADS;
|
||||||
import static org.lwjgl.opengl.GL11.glDisable;
|
|
||||||
import static org.lwjgl.opengl.GL11.glEnable;
|
|
||||||
import static org.lwjgl.opengl.GL12.GL_TEXTURE_3D;
|
|
||||||
import static org.lwjgl.opengl.GL13.GL_TEXTURE0;
|
import static org.lwjgl.opengl.GL13.GL_TEXTURE0;
|
||||||
import static org.lwjgl.opengl.GL13.GL_TEXTURE4;
|
import static org.lwjgl.opengl.GL13.GL_TEXTURE4;
|
||||||
|
import static org.lwjgl.opengl.GL13.GL_TEXTURE_3D;
|
||||||
import static org.lwjgl.opengl.GL13.glActiveTexture;
|
import static org.lwjgl.opengl.GL13.glActiveTexture;
|
||||||
|
import static org.lwjgl.opengl.GL13.glDisable;
|
||||||
|
import static org.lwjgl.opengl.GL13.glEnable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -231,7 +231,7 @@ public class ContraptionRenderDispatcher {
|
||||||
|
|
||||||
public static void renderStructure(World world, PlacementSimulationWorld renderWorld, Contraption c,
|
public static void renderStructure(World world, PlacementSimulationWorld renderWorld, Contraption c,
|
||||||
ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
|
ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
|
||||||
SuperByteBufferCache bufferCache = CreateClient.bufferCache;
|
SuperByteBufferCache bufferCache = CreateClient.BUFFER_CACHE;
|
||||||
List<RenderType> blockLayers = RenderType.getBlockLayers();
|
List<RenderType> blockLayers = RenderType.getBlockLayers();
|
||||||
|
|
||||||
buffer.getBuffer(RenderType.getSolid());
|
buffer.getBuffer(RenderType.getSolid());
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class CouplingHandler {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (safetyCount-- <= 0) {
|
if (safetyCount-- <= 0) {
|
||||||
Create.logger.warn("Infinite loop in coupling iteration");
|
Create.LOGGER.warn("Infinite loop in coupling iteration");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,24 +219,24 @@ public class CouplingRenderer {
|
||||||
MinecartController first = c.getFirst();
|
MinecartController first = c.getFirst();
|
||||||
AbstractMinecartEntity mainCart = first.cart();
|
AbstractMinecartEntity mainCart = first.cart();
|
||||||
Vector3d mainCenter = mainCart.getPositionVec()
|
Vector3d mainCenter = mainCart.getPositionVec()
|
||||||
.add(0, yOffset, 0);
|
.add(0, yOffset, 0);
|
||||||
Vector3d connectedCenter = c.getSecond()
|
Vector3d connectedCenter = c.getSecond()
|
||||||
.cart()
|
.cart()
|
||||||
.getPositionVec()
|
.getPositionVec()
|
||||||
.add(0, yOffset, 0);
|
.add(0, yOffset, 0);
|
||||||
|
|
||||||
int color = ColorHelper.mixColors(0xabf0e9, 0xee8572, (float) MathHelper
|
int color = ColorHelper.mixColors(0xabf0e9, 0xee8572, (float) MathHelper
|
||||||
.clamp(Math.abs(first.getCouplingLength(true) - connectedCenter.distanceTo(mainCenter)) * 8, 0, 1));
|
.clamp(Math.abs(first.getCouplingLength(true) - connectedCenter.distanceTo(mainCenter)) * 8, 0, 1));
|
||||||
|
|
||||||
CreateClient.outliner.showLine(mainCart.getEntityId() + "", mainCenter, connectedCenter)
|
CreateClient.OUTLINER.showLine(mainCart.getEntityId() + "", mainCenter, connectedCenter)
|
||||||
.colored(color)
|
.colored(color)
|
||||||
.lineWidth(1 / 8f);
|
.lineWidth(1 / 8f);
|
||||||
|
|
||||||
Vector3d point = mainCart.getPositionVec()
|
Vector3d point = mainCart.getPositionVec()
|
||||||
.add(0, yOffset, 0);
|
.add(0, yOffset, 0);
|
||||||
CreateClient.outliner.showLine(mainCart.getEntityId() + "_dot", point, point.add(0, 1 / 128f, 0))
|
CreateClient.OUTLINER.showLine(mainCart.getEntityId() + "_dot", point, point.add(0, 1 / 128f, 0))
|
||||||
.colored(0xffffff)
|
.colored(0xffffff)
|
||||||
.lineWidth(1 / 4f);
|
.lineWidth(1 / 4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class MinecartController implements INBTSerializable<CompoundNBT> {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (safetyCount-- <= 0) {
|
if (safetyCount-- <= 0) {
|
||||||
Create.logger.warn("Infinite loop in coupling iteration");
|
Create.LOGGER.warn("Infinite loop in coupling iteration");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cartsToFlip.add(current);
|
cartsToFlip.add(current);
|
||||||
|
|
|
@ -138,10 +138,10 @@ public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBloc
|
||||||
}
|
}
|
||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
return ItemRequirement.of(AllBlocks.FLUID_PIPE.getDefaultState());
|
return ItemRequirement.of(AllBlocks.FLUID_PIPE.getDefaultState(), te);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,8 +148,8 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
||||||
FluidTransportBehaviour transport = TileEntityBehaviour.get(world, neighbourPos, FluidTransportBehaviour.TYPE);
|
FluidTransportBehaviour transport = TileEntityBehaviour.get(world, neighbourPos, FluidTransportBehaviour.TYPE);
|
||||||
BracketedTileEntityBehaviour bracket = TileEntityBehaviour.get(world, neighbourPos, BracketedTileEntityBehaviour.TYPE);
|
BracketedTileEntityBehaviour bracket = TileEntityBehaviour.get(world, neighbourPos, BracketedTileEntityBehaviour.TYPE);
|
||||||
if (isPipe(neighbour))
|
if (isPipe(neighbour))
|
||||||
return bracket == null || !bracket.isBacketPresent()
|
return bracket == null || !bracket.isBracketPresent()
|
||||||
|| FluidPropagator.getStraightPipeAxis(neighbour) == direction.getAxis();
|
|| FluidPropagator.getStraightPipeAxis(neighbour) == direction.getAxis();
|
||||||
if (transport == null)
|
if (transport == null)
|
||||||
return false;
|
return false;
|
||||||
return transport.canHaveFlowToward(neighbour, direction.getOpposite());
|
return transport.canHaveFlowToward(neighbour, direction.getOpposite());
|
||||||
|
@ -228,7 +228,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
||||||
IBlockDisplayReader world, BlockPos pos) {
|
IBlockDisplayReader world, BlockPos pos) {
|
||||||
|
|
||||||
BracketedTileEntityBehaviour bracket = TileEntityBehaviour.get(world, pos, BracketedTileEntityBehaviour.TYPE);
|
BracketedTileEntityBehaviour bracket = TileEntityBehaviour.get(world, pos, BracketedTileEntityBehaviour.TYPE);
|
||||||
if (bracket != null && bracket.isBacketPresent())
|
if (bracket != null && bracket.isBracketPresent())
|
||||||
return state;
|
return state;
|
||||||
|
|
||||||
// Update sides that are not ignored
|
// Update sides that are not ignored
|
||||||
|
@ -275,10 +275,10 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
return Optional.of(new ItemStack(bracket.getBlock()));
|
return Optional.of(new ItemStack(bracket.getBlock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,15 +78,15 @@ public class GlassFluidPipeBlock extends AxisPipeBlock implements IWaterLoggable
|
||||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false)
|
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false)
|
||||||
: Fluids.EMPTY.getDefaultState();
|
: Fluids.EMPTY.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
return ItemRequirement.of(AllBlocks.FLUID_PIPE.getDefaultState());
|
return ItemRequirement.of(AllBlocks.FLUID_PIPE.getDefaultState(), te);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
@EventBusSubscriber(value = Dist.CLIENT)
|
@EventBusSubscriber(value = Dist.CLIENT)
|
||||||
public class GoggleOverlayRenderer {
|
public class GoggleOverlayRenderer {
|
||||||
|
|
||||||
private static final Map<Object, OutlineEntry> outlines = CreateClient.outliner.getOutlines();
|
private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines();
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
||||||
this.maxAge = 40;
|
this.maxAge = 40;
|
||||||
canCollide = false;
|
canCollide = false;
|
||||||
selectSprite(7);
|
selectSprite(7);
|
||||||
Vector3d offset = VecHelper.offsetRandomly(Vector3d.ZERO, Create.random, .25f);
|
Vector3d offset = VecHelper.offsetRandomly(Vector3d.ZERO, Create.RANDOM, .25f);
|
||||||
this.setPosition(posX + offset.x, posY + offset.y, posZ + offset.z);
|
this.setPosition(posX + offset.x, posY + offset.y, posZ + offset.z);
|
||||||
this.prevPosX = posX;
|
this.prevPosX = posX;
|
||||||
this.prevPosY = posY;
|
this.prevPosY = posY;
|
||||||
|
|
|
@ -39,9 +39,9 @@ public class AirParticle extends SimpleAnimatedParticle {
|
||||||
targetZ = (float) (z + dz);
|
targetZ = (float) (z + dz);
|
||||||
drag = data.drag;
|
drag = data.drag;
|
||||||
|
|
||||||
twirlRadius = Create.random.nextFloat() / 6;
|
twirlRadius = Create.RANDOM.nextFloat() / 6;
|
||||||
twirlAngleOffset = Create.random.nextFloat() * 360;
|
twirlAngleOffset = Create.RANDOM.nextFloat() * 360;
|
||||||
twirlAxis = Create.random.nextBoolean() ? Axis.X : Axis.Z;
|
twirlAxis = Create.RANDOM.nextBoolean() ? Axis.X : Axis.Z;
|
||||||
|
|
||||||
// speed in m/ticks
|
// speed in m/ticks
|
||||||
maxAge = Math.min((int) (new Vector3d(dx, dy, dz).length() / data.speed), 60);
|
maxAge = Math.min((int) (new Vector3d(dx, dy, dz).length() / data.speed), 60);
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
|
||||||
}
|
}
|
||||||
if (success)
|
if (success)
|
||||||
worldIn.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, .2f,
|
worldIn.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, .2f,
|
||||||
1f + Create.random.nextFloat());
|
1f + Create.RANDOM.nextFloat());
|
||||||
te.onEmptied();
|
te.onEmptied();
|
||||||
} catch (TileEntityException e) {
|
} catch (TileEntityException e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ public enum HeatCondition {
|
||||||
NONE(0xffffff), HEATED(0xE88300), SUPERHEATED(0x5C93E8),
|
NONE(0xffffff), HEATED(0xE88300), SUPERHEATED(0x5C93E8),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private int color;
|
private int color;
|
||||||
|
|
||||||
private HeatCondition(int color) {
|
private HeatCondition(int color) {
|
||||||
|
@ -36,7 +36,7 @@ public enum HeatCondition {
|
||||||
public String serialize() {
|
public String serialize() {
|
||||||
return Lang.asId(name());
|
return Lang.asId(name());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTranslationKey() {
|
public String getTranslationKey() {
|
||||||
return "recipe.heat_requirement." + serialize();
|
return "recipe.heat_requirement." + serialize();
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,9 @@ public enum HeatCondition {
|
||||||
public static HeatCondition deserialize(String name) {
|
public static HeatCondition deserialize(String name) {
|
||||||
for (HeatCondition heatCondition : values())
|
for (HeatCondition heatCondition : values())
|
||||||
if (heatCondition.serialize()
|
if (heatCondition.serialize()
|
||||||
.equals(name))
|
.equals(name))
|
||||||
return heatCondition;
|
return heatCondition;
|
||||||
Create.logger.warn("Tried to deserialize invalid heat condition: \"" + name + "\"");
|
Create.LOGGER.warn("Tried to deserialize invalid heat condition: \"" + name + "\"");
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,17 +85,17 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
|
||||||
|
|
||||||
private void validate(String recipeTypeName) {
|
private void validate(String recipeTypeName) {
|
||||||
String messageHeader = "Your custom " + recipeTypeName + " recipe (" + id.toString() + ")";
|
String messageHeader = "Your custom " + recipeTypeName + " recipe (" + id.toString() + ")";
|
||||||
Logger logger = Create.logger;
|
Logger logger = Create.LOGGER;
|
||||||
int ingredientCount = ingredients.size();
|
int ingredientCount = ingredients.size();
|
||||||
int outputCount = results.size();
|
int outputCount = results.size();
|
||||||
|
|
||||||
if (ingredientCount > getMaxInputCount())
|
if (ingredientCount > getMaxInputCount())
|
||||||
logger.warn(messageHeader + " has more item inputs (" + ingredientCount + ") than supported ("
|
logger.warn(messageHeader + " has more item inputs (" + ingredientCount + ") than supported ("
|
||||||
+ getMaxInputCount() + ").");
|
+ getMaxInputCount() + ").");
|
||||||
|
|
||||||
if (outputCount > getMaxOutputCount())
|
if (outputCount > getMaxOutputCount())
|
||||||
logger.warn(messageHeader + " has more item outputs (" + outputCount + ") than supported ("
|
logger.warn(messageHeader + " has more item outputs (" + outputCount + ") than supported ("
|
||||||
+ getMaxOutputCount() + ").");
|
+ getMaxOutputCount() + ").");
|
||||||
|
|
||||||
if (processingDuration > 0 && !canSpecifyDuration())
|
if (processingDuration > 0 && !canSpecifyDuration())
|
||||||
logger.warn(messageHeader + " specified a duration. Durations have no impact on this type of recipe.");
|
logger.warn(messageHeader + " specified a duration. Durations have no impact on this type of recipe.");
|
||||||
|
@ -120,15 +120,15 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
|
||||||
public NonNullList<Ingredient> getIngredients() {
|
public NonNullList<Ingredient> getIngredients() {
|
||||||
return ingredients;
|
return ingredients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NonNullList<FluidIngredient> getFluidIngredients() {
|
public NonNullList<FluidIngredient> getFluidIngredients() {
|
||||||
return fluidIngredients;
|
return fluidIngredients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NonNullList<ProcessingOutput> getRollableResults() {
|
public NonNullList<ProcessingOutput> getRollableResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NonNullList<FluidStack> getFluidResults() {
|
public NonNullList<FluidStack> getFluidResults() {
|
||||||
return fluidResults;
|
return fluidResults;
|
||||||
}
|
}
|
||||||
|
@ -156,9 +156,9 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
|
||||||
public HeatCondition getRequiredHeat() {
|
public HeatCondition getRequiredHeat() {
|
||||||
return requiredHeat;
|
return requiredHeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRecipe<> paperwork
|
// IRecipe<> paperwork
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(T inv) {
|
public ItemStack getCraftingResult(T inv) {
|
||||||
return getRecipeOutput();
|
return getRecipeOutput();
|
||||||
|
@ -180,7 +180,7 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
|
||||||
public ResourceLocation getId() {
|
public ResourceLocation getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDynamic() {
|
public boolean isDynamic() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -53,8 +53,8 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
||||||
}
|
}
|
||||||
|
|
||||||
private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) {
|
private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) {
|
||||||
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
return CreateClient.BUFFER_CACHE.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
||||||
KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)));
|
KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
});
|
});
|
||||||
if (success.isTrue())
|
if (success.isTrue())
|
||||||
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, .2f,
|
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, .2f,
|
||||||
1f + Create.random.nextFloat());
|
1f + Create.RANDOM.nextFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isShaft) {
|
if (isShaft) {
|
||||||
|
@ -588,7 +588,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
List<ItemStack> required = new ArrayList<>();
|
List<ItemStack> required = new ArrayList<>();
|
||||||
if (state.get(PART) != BeltPart.MIDDLE)
|
if (state.get(PART) != BeltPart.MIDDLE)
|
||||||
required.add(AllBlocks.SHAFT.asStack());
|
required.add(AllBlocks.SHAFT.asStack());
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
return stack;
|
return stack;
|
||||||
};
|
};
|
||||||
|
|
||||||
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, matrixStackSupplier);
|
SuperByteBuffer superBuffer = CreateClient.BUFFER_CACHE.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, matrixStackSupplier);
|
||||||
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
|
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class BeltConnectorItem extends BlockItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillItemGroup(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
|
public void fillItemGroup(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
|
||||||
if (p_150895_1_ == Create.baseCreativeTab)
|
if (p_150895_1_ == Create.BASE_CREATIVE_TAB)
|
||||||
return;
|
return;
|
||||||
super.fillItemGroup(p_150895_1_, p_150895_2_);
|
super.fillItemGroup(p_150895_1_, p_150895_2_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraftforge.client.model.data.ModelProperty;
|
||||||
|
|
||||||
public class BracketedKineticBlockModel extends BakedModelWrapper<IBakedModel> {
|
public class BracketedKineticBlockModel extends BakedModelWrapper<IBakedModel> {
|
||||||
|
|
||||||
private static ModelProperty<BracketedModelData> BRACKET_PROPERTY = new ModelProperty<>();
|
private static final ModelProperty<BracketedModelData> BRACKET_PROPERTY = new ModelProperty<>();
|
||||||
|
|
||||||
public BracketedKineticBlockModel(IBakedModel template) {
|
public BracketedKineticBlockModel(IBakedModel template) {
|
||||||
super(template);
|
super(template);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
import com.simibubi.create.foundation.advancement.ITriggerable;
|
import com.simibubi.create.foundation.advancement.ITriggerable;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
|
@ -38,7 +39,7 @@ public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
||||||
this.pred = pred;
|
this.pred = pred;
|
||||||
bracket = Optional.empty();
|
bracket = Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BracketedTileEntityBehaviour withTrigger(Function<BlockState, ITriggerable> trigger) {
|
public BracketedTileEntityBehaviour withTrigger(Function<BlockState, ITriggerable> trigger) {
|
||||||
this.trigger = trigger;
|
this.trigger = trigger;
|
||||||
return this;
|
return this;
|
||||||
|
@ -54,7 +55,7 @@ public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
||||||
reRender = true;
|
reRender = true;
|
||||||
tileEntity.notifyUpdate();
|
tileEntity.notifyUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerAdvancements(World world, PlayerEntity player, BlockState state) {
|
public void triggerAdvancements(World world, PlayerEntity player, BlockState state) {
|
||||||
if (trigger == null)
|
if (trigger == null)
|
||||||
return;
|
return;
|
||||||
|
@ -73,7 +74,7 @@ public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
||||||
tileEntity.notifyUpdate();
|
tileEntity.notifyUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBacketPresent() {
|
public boolean isBracketPresent() {
|
||||||
return getBracket() != Blocks.AIR.getDefaultState();
|
return getBracket() != Blocks.AIR.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +82,16 @@ public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
||||||
return bracket.orElse(Blocks.AIR.getDefaultState());
|
return bracket.orElse(Blocks.AIR.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemRequirement getRequiredItems() {
|
||||||
|
return ItemRequirement.of(getBracket(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSafeNBT() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(CompoundNBT nbt, boolean clientPacket) {
|
public void write(CompoundNBT nbt, boolean clientPacket) {
|
||||||
bracket.ifPresent(p -> nbt.put("Bracket", NBTUtil.writeBlockState(p)));
|
bracket.ifPresent(p -> nbt.put("Bracket", NBTUtil.writeBlockState(p)));
|
||||||
|
|
|
@ -22,11 +22,11 @@ public class EncasedShaftBlock extends AbstractEncasedShaftBlock implements ISpe
|
||||||
public static EncasedShaftBlock andesite(Properties properties) {
|
public static EncasedShaftBlock andesite(Properties properties) {
|
||||||
return new EncasedShaftBlock(properties, AllBlocks.ANDESITE_CASING);
|
return new EncasedShaftBlock(properties, AllBlocks.ANDESITE_CASING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EncasedShaftBlock brass(Properties properties) {
|
public static EncasedShaftBlock brass(Properties properties) {
|
||||||
return new EncasedShaftBlock(properties, AllBlocks.BRASS_CASING);
|
return new EncasedShaftBlock(properties, AllBlocks.BRASS_CASING);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EncasedShaftBlock(Properties properties, BlockEntry<CasingBlock> casing) {
|
protected EncasedShaftBlock(Properties properties, BlockEntry<CasingBlock> casing) {
|
||||||
super(properties);
|
super(properties);
|
||||||
this.casing = casing;
|
this.casing = casing;
|
||||||
|
@ -36,7 +36,7 @@ public class EncasedShaftBlock extends AbstractEncasedShaftBlock implements ISpe
|
||||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return AllTileEntities.ENCASED_SHAFT.create();
|
return AllTileEntities.ENCASED_SHAFT.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockEntry<CasingBlock> getCasing() {
|
public BlockEntry<CasingBlock> getCasing() {
|
||||||
return casing;
|
return casing;
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,10 @@ public class EncasedShaftBlock extends AbstractEncasedShaftBlock implements ISpe
|
||||||
KineticTileEntity.switchToBlockState(context.getWorld(), context.getPos(), AllBlocks.SHAFT.getDefaultState().with(AXIS, state.get(AXIS)));
|
KineticTileEntity.switchToBlockState(context.getWorld(), context.getPos(), AllBlocks.SHAFT.getDefaultState().with(AXIS, state.get(AXIS)));
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
return ItemRequirement.of(AllBlocks.SHAFT.getDefaultState());
|
return ItemRequirement.of(AllBlocks.SHAFT.getDefaultState(), te);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,11 +71,11 @@ public interface IWrenchable {
|
||||||
}
|
}
|
||||||
|
|
||||||
default void playRemoveSound(World world, BlockPos pos) {
|
default void playRemoveSound(World world, BlockPos pos) {
|
||||||
AllSoundEvents.WRENCH_REMOVE.playOnServer(world, pos, 1, Create.random.nextFloat() * .5f + .5f);
|
AllSoundEvents.WRENCH_REMOVE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() * .5f + .5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void playRotateSound(World world, BlockPos pos) {
|
default void playRotateSound(World world, BlockPos pos) {
|
||||||
AllSoundEvents.WRENCH_ROTATE.playOnServer(world, pos, 1, Create.random.nextFloat() + .5f);
|
AllSoundEvents.WRENCH_ROTATE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() + .5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
default BlockState getRotatedBlockState(BlockState originalState, Direction targetedFace) {
|
default BlockState getRotatedBlockState(BlockState originalState, Direction targetedFace) {
|
||||||
|
|
|
@ -59,18 +59,18 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
|
||||||
ms.push();
|
ms.push();
|
||||||
BipedModel<?> model = (BipedModel<?>) entityModel;
|
BipedModel<?> model = (BipedModel<?>) entityModel;
|
||||||
BlockState renderedState = AllBlocks.COPPER_BACKTANK.getDefaultState()
|
BlockState renderedState = AllBlocks.COPPER_BACKTANK.getDefaultState()
|
||||||
.with(CopperBacktankBlock.HORIZONTAL_FACING, Direction.SOUTH);
|
.with(CopperBacktankBlock.HORIZONTAL_FACING, Direction.SOUTH);
|
||||||
RenderType renderType = RenderType.getCutout();
|
RenderType renderType = RenderType.getCutout();
|
||||||
|
|
||||||
SuperByteBuffer backtank = CreateClient.bufferCache.renderBlock(renderedState);
|
SuperByteBuffer backtank = CreateClient.BUFFER_CACHE.renderBlock(renderedState);
|
||||||
SuperByteBuffer cogs =
|
SuperByteBuffer cogs =
|
||||||
CreateClient.bufferCache.renderPartial(AllBlockPartials.COPPER_BACKTANK_COGS, renderedState);
|
CreateClient.BUFFER_CACHE.renderPartial(AllBlockPartials.COPPER_BACKTANK_COGS, renderedState);
|
||||||
|
|
||||||
model.bipedBody.rotate(ms);
|
model.bipedBody.rotate(ms);
|
||||||
ms.translate(-1 / 2f, 10 / 16f, 1f);
|
ms.translate(-1 / 2f, 10 / 16f, 1f);
|
||||||
ms.scale(1, -1, -1);
|
ms.scale(1, -1, -1);
|
||||||
backtank.light(light)
|
backtank.light(light)
|
||||||
.renderInto(ms, buffer.getBuffer(renderType));
|
.renderInto(ms, buffer.getBuffer(renderType));
|
||||||
|
|
||||||
cogs.matrixStacker()
|
cogs.matrixStacker()
|
||||||
.centre()
|
.centre()
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CopperBacktankRenderer extends KineticTileEntityRenderer {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
SuperByteBuffer cogs =
|
SuperByteBuffer cogs =
|
||||||
CreateClient.bufferCache.renderPartial(AllBlockPartials.COPPER_BACKTANK_COGS, te.getBlockState());
|
CreateClient.BUFFER_CACHE.renderPartial(AllBlockPartials.COPPER_BACKTANK_COGS, te.getBlockState());
|
||||||
cogs.matrixStacker()
|
cogs.matrixStacker()
|
||||||
.centre()
|
.centre()
|
||||||
.rotateY(180 + AngleHelper.horizontalAngle(te.getBlockState()
|
.rotateY(180 + AngleHelper.horizontalAngle(te.getBlockState()
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements IName
|
||||||
int max = getMaxAir();
|
int max = getMaxAir();
|
||||||
if (world.isRemote) {
|
if (world.isRemote) {
|
||||||
Vector3d centerOf = VecHelper.getCenterOf(pos);
|
Vector3d centerOf = VecHelper.getCenterOf(pos);
|
||||||
Vector3d v = VecHelper.offsetRandomly(centerOf, Create.random, .65f);
|
Vector3d v = VecHelper.offsetRandomly(centerOf, Create.RANDOM, .65f);
|
||||||
Vector3d m = centerOf.subtract(v);
|
Vector3d m = centerOf.subtract(v);
|
||||||
if (airLevel != max)
|
if (airLevel != max)
|
||||||
world.addParticle(new AirParticleData(1, .05f), v.x, v.y, v.z, m.x, m.y, m.z);
|
world.addParticle(new AirParticleData(1, .05f), v.x, v.y, v.z, m.x, m.y, m.z);
|
||||||
|
|
|
@ -90,10 +90,10 @@ public class ZapperRenderHandler {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cachedBeams.forEach(beam -> {
|
cachedBeams.forEach(beam -> {
|
||||||
CreateClient.outliner.endChasingLine(beam, beam.start, beam.end, 1 - beam.itensity)
|
CreateClient.OUTLINER.endChasingLine(beam, beam.start, beam.end, 1 - beam.itensity)
|
||||||
.disableNormals()
|
.disableNormals()
|
||||||
.colored(0xffffff)
|
.colored(0xffffff)
|
||||||
.lineWidth(beam.itensity * 1 / 8f);
|
.lineWidth(beam.itensity * 1 / 8f);
|
||||||
});
|
});
|
||||||
|
|
||||||
cachedBeams.forEach(b -> b.itensity *= .6f);
|
cachedBeams.forEach(b -> b.itensity *= .6f);
|
||||||
|
|
|
@ -31,11 +31,11 @@ public class WorldshaperRenderHandler {
|
||||||
if (renderedPositions == null)
|
if (renderedPositions == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CreateClient.outliner.showCluster("terrainZapper", renderedPositions.get())
|
CreateClient.OUTLINER.showCluster("terrainZapper", renderedPositions.get())
|
||||||
.colored(0xbfbfbf)
|
.colored(0xbfbfbf)
|
||||||
.disableNormals()
|
.disableNormals()
|
||||||
.lineWidth(1 / 32f)
|
.lineWidth(1 / 32f)
|
||||||
.withFaceTexture(AllSpecialTextures.CHECKERED);
|
.withFaceTexture(AllSpecialTextures.CHECKERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void gatherSelectedBlocks() {
|
protected static void gatherSelectedBlocks() {
|
||||||
|
|
|
@ -67,12 +67,12 @@ public class RedstoneLinkNetworkHandler {
|
||||||
|
|
||||||
public void onLoadWorld(IWorld world) {
|
public void onLoadWorld(IWorld world) {
|
||||||
connections.put(world, new HashMap<>());
|
connections.put(world, new HashMap<>());
|
||||||
Create.logger.debug("Prepared Redstone Network Space for " + WorldHelper.getDimensionID(world));
|
Create.LOGGER.debug("Prepared Redstone Network Space for " + WorldHelper.getDimensionID(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUnloadWorld(IWorld world) {
|
public void onUnloadWorld(IWorld world) {
|
||||||
connections.remove(world);
|
connections.remove(world);
|
||||||
Create.logger.debug("Removed Redstone Network Space for " + WorldHelper.getDimensionID(world));
|
Create.LOGGER.debug("Removed Redstone Network Space for " + WorldHelper.getDimensionID(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<LinkBehaviour> getNetworkOf(LinkBehaviour actor) {
|
public Set<LinkBehaviour> getNetworkOf(LinkBehaviour actor) {
|
||||||
|
@ -144,7 +144,7 @@ public class RedstoneLinkNetworkHandler {
|
||||||
|
|
||||||
public Map<Pair<Frequency, Frequency>, Set<LinkBehaviour>> networksIn(IWorld world) {
|
public Map<Pair<Frequency, Frequency>, Set<LinkBehaviour>> networksIn(IWorld world) {
|
||||||
if (!connections.containsKey(world)) {
|
if (!connections.containsKey(world)) {
|
||||||
Create.logger.warn(
|
Create.LOGGER.warn(
|
||||||
"Tried to Access unprepared network space of " + WorldHelper.getDimensionID(world));
|
"Tried to Access unprepared network space of " + WorldHelper.getDimensionID(world));
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,12 +313,12 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
return;
|
return;
|
||||||
AirParticleData airParticleData = new AirParticleData(drag, motion);
|
AirParticleData airParticleData = new AirParticleData(drag, motion);
|
||||||
Vector3d origin = Vector3d.of(pos);
|
Vector3d origin = Vector3d.of(pos);
|
||||||
float xOff = Create.random.nextFloat() * .5f + .25f;
|
float xOff = Create.RANDOM.nextFloat() * .5f + .25f;
|
||||||
float zOff = Create.random.nextFloat() * .5f + .25f;
|
float zOff = Create.RANDOM.nextFloat() * .5f + .25f;
|
||||||
Vector3d v = origin.add(xOff, verticalStart, zOff);
|
Vector3d v = origin.add(xOff, verticalStart, zOff);
|
||||||
Vector3d d = origin.add(xOff, verticalEnd, zOff)
|
Vector3d d = origin.add(xOff, verticalEnd, zOff)
|
||||||
.subtract(v);
|
.subtract(v);
|
||||||
if (Create.random.nextFloat() < 2 * motion)
|
if (Create.RANDOM.nextFloat() < 2 * motion)
|
||||||
world.addOptionalParticle(airParticleData, v.x, v.y, v.z, d.x, d.y, d.z);
|
world.addOptionalParticle(airParticleData, v.x, v.y, v.z, d.x, d.y, d.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,14 +210,14 @@ public class EjectorTargetHandler {
|
||||||
ClientWorld world = mc.world;
|
ClientWorld world = mc.world;
|
||||||
|
|
||||||
AxisAlignedBB bb = new AxisAlignedBB(0, 0, 0, 1, 0, 1).offset(currentSelection.add(-validX, -yDiff, -validZ));
|
AxisAlignedBB bb = new AxisAlignedBB(0, 0, 0, 1, 0, 1).offset(currentSelection.add(-validX, -yDiff, -validZ));
|
||||||
CreateClient.outliner.chaseAABB("valid", bb)
|
CreateClient.OUTLINER.chaseAABB("valid", bb)
|
||||||
.colored(intColor)
|
.colored(intColor)
|
||||||
.lineWidth(1 / 16f);
|
.lineWidth(1 / 16f);
|
||||||
|
|
||||||
for (int i = 0; i < segments; i++) {
|
for (int i = 0; i < segments; i++) {
|
||||||
double ticks = ((AnimationTickHolder.getRenderTime() / 3) % tickOffset) + i * tickOffset;
|
double ticks = ((AnimationTickHolder.getRenderTime() / 3) % tickOffset) + i * tickOffset;
|
||||||
Vector3d vec = launcher.getGlobalPos(ticks, d, pos)
|
Vector3d vec = launcher.getGlobalPos(ticks, d, pos)
|
||||||
.add(xDiff - validX, 0, zDiff - validZ);
|
.add(xDiff - validX, 0, zDiff - validZ);
|
||||||
world.addParticle(data, vec.x, vec.y, vec.z, 0, 0, 0);
|
world.addParticle(data, vec.x, vec.y, vec.z, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,9 +260,9 @@ public class EjectorTargetHandler {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
VoxelShape shape = state.getShape(world, pos);
|
VoxelShape shape = state.getShape(world, pos);
|
||||||
AxisAlignedBB boundingBox = shape.isEmpty() ? new AxisAlignedBB(BlockPos.ZERO) : shape.getBoundingBox();
|
AxisAlignedBB boundingBox = shape.isEmpty() ? new AxisAlignedBB(BlockPos.ZERO) : shape.getBoundingBox();
|
||||||
CreateClient.outliner.showAABB("target", boundingBox.offset(pos))
|
CreateClient.OUTLINER.showAABB("target", boundingBox.offset(pos))
|
||||||
.colored(0xffcb74)
|
.colored(0xffcb74)
|
||||||
.lineWidth(1 / 16f);
|
.lineWidth(1 / 16f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class SharedDepotBlockMethods {
|
||||||
player.inventory.placeItemBackInInventory(world, mainItemStack);
|
player.inventory.placeItemBackInInventory(world, mainItemStack);
|
||||||
behaviour.removeHeldItem();
|
behaviour.removeHeldItem();
|
||||||
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, .2f,
|
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, .2f,
|
||||||
1f + Create.random.nextFloat());
|
1f + Create.RANDOM.nextFloat());
|
||||||
}
|
}
|
||||||
ItemStackHandler outputs = behaviour.processingOutputBuffer;
|
ItemStackHandler outputs = behaviour.processingOutputBuffer;
|
||||||
for (int i = 0; i < outputs.getSlots(); i++)
|
for (int i = 0; i < outputs.getSlots(); i++)
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.state.EnumProperty;
|
import net.minecraft.state.EnumProperty;
|
||||||
import net.minecraft.state.StateContainer.Builder;
|
import net.minecraft.state.StateContainer.Builder;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
@ -192,8 +193,8 @@ public class BeltFunnelBlock extends AbstractHorizontalFunnelBlock implements IS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
return ItemRequirement.of(parent.getDefaultState());
|
return ItemRequirement.of(parent.getDefaultState(), te);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
|
import net.minecraft.inventory.container.ContainerType;
|
||||||
import net.minecraft.inventory.container.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
@ -19,8 +20,8 @@ public class AdjustableCrateContainer extends Container {
|
||||||
public PlayerInventory playerInventory;
|
public PlayerInventory playerInventory;
|
||||||
public boolean doubleCrate;
|
public boolean doubleCrate;
|
||||||
|
|
||||||
public AdjustableCrateContainer(int id, PlayerInventory inv, PacketBuffer extraData) {
|
public AdjustableCrateContainer(ContainerType<?> type, int id, PlayerInventory inv, PacketBuffer extraData) {
|
||||||
super(AllContainerTypes.FLEXCRATE.type, id);
|
super(type, id);
|
||||||
ClientWorld world = Minecraft.getInstance().world;
|
ClientWorld world = Minecraft.getInstance().world;
|
||||||
TileEntity tileEntity = world.getTileEntity(extraData.readBlockPos());
|
TileEntity tileEntity = world.getTileEntity(extraData.readBlockPos());
|
||||||
this.playerInventory = inv;
|
this.playerInventory = inv;
|
||||||
|
@ -31,13 +32,17 @@ public class AdjustableCrateContainer extends Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdjustableCrateContainer(int id, PlayerInventory inv, AdjustableCrateTileEntity te) {
|
public AdjustableCrateContainer(ContainerType<?> type, int id, PlayerInventory inv, AdjustableCrateTileEntity te) {
|
||||||
super(AllContainerTypes.FLEXCRATE.type, id);
|
super(type, id);
|
||||||
this.te = te;
|
this.te = te;
|
||||||
this.playerInventory = inv;
|
this.playerInventory = inv;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AdjustableCrateContainer create(int id, PlayerInventory inv, AdjustableCrateTileEntity te) {
|
||||||
|
return new AdjustableCrateContainer(AllContainerTypes.FLEXCRATE.get(), id, inv, te);
|
||||||
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
doubleCrate = te.isDoubleCrate();
|
doubleCrate = te.isDoubleCrate();
|
||||||
int x = doubleCrate ? 51 : 123;
|
int x = doubleCrate ? 51 : 123;
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class AdjustableCrateTileEntity extends CrateTileEntity implements INamed
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) {
|
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) {
|
||||||
return new AdjustableCrateContainer(id, inventory, this);
|
return AdjustableCrateContainer.create(id, inventory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdjustableCrateTileEntity getOtherCrate() {
|
public AdjustableCrateTileEntity getOtherCrate() {
|
||||||
|
|
|
@ -195,10 +195,10 @@ public class ArmInteractionPointHandler {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int color = point.mode == Mode.DEPOSIT ? 0xffcb74 : 0x4f8a8b;
|
int color = point.mode == Mode.DEPOSIT ? 0xffcb74 : 0x4f8a8b;
|
||||||
CreateClient.outliner.showAABB(point, shape.getBoundingBox()
|
CreateClient.OUTLINER.showAABB(point, shape.getBoundingBox()
|
||||||
.offset(pos))
|
.offset(pos))
|
||||||
.colored(color)
|
.colored(color)
|
||||||
.lineWidth(1 / 16f);
|
.lineWidth(1 / 16f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ public class ArmTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
if (!prevHeld.isItemEqual(heldItem))
|
if (!prevHeld.isItemEqual(heldItem))
|
||||||
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .125f,
|
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .125f,
|
||||||
.5f + Create.random.nextFloat() * .25f);
|
.5f + Create.RANDOM.nextFloat() * .25f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.foundation.utility.Pair;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.container.ClickType;
|
import net.minecraft.inventory.container.ClickType;
|
||||||
|
import net.minecraft.inventory.container.ContainerType;
|
||||||
import net.minecraft.inventory.container.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
|
@ -30,12 +31,16 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
||||||
WhitelistMode whitelistMode;
|
WhitelistMode whitelistMode;
|
||||||
List<Pair<ItemAttribute, Boolean>> selectedAttributes;
|
List<Pair<ItemAttribute, Boolean>> selectedAttributes;
|
||||||
|
|
||||||
public AttributeFilterContainer(int id, PlayerInventory inv, PacketBuffer extraData) {
|
public AttributeFilterContainer(ContainerType<?> type, int id, PlayerInventory inv, PacketBuffer extraData) {
|
||||||
super(AllContainerTypes.ATTRIBUTE_FILTER.type, id, inv, extraData);
|
super(type, id, inv, extraData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttributeFilterContainer(int id, PlayerInventory inv, ItemStack stack) {
|
public AttributeFilterContainer(ContainerType<?> type, int id, PlayerInventory inv, ItemStack stack) {
|
||||||
super(AllContainerTypes.ATTRIBUTE_FILTER.type, id, inv, stack);
|
super(type, id, inv, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AttributeFilterContainer create(int id, PlayerInventory inv, ItemStack stack) {
|
||||||
|
return new AttributeFilterContainer(AllContainerTypes.ATTRIBUTE_FILTER.get(), id, inv, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void appendSelectedAttribute(ItemAttribute itemAttribute, boolean inverted) {
|
public void appendSelectedAttribute(ItemAttribute itemAttribute, boolean inverted) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.item.filter;
|
||||||
import com.simibubi.create.AllContainerTypes;
|
import com.simibubi.create.AllContainerTypes;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.inventory.container.ContainerType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
@ -14,12 +15,16 @@ public class FilterContainer extends AbstractFilterContainer {
|
||||||
boolean respectNBT;
|
boolean respectNBT;
|
||||||
boolean blacklist;
|
boolean blacklist;
|
||||||
|
|
||||||
public FilterContainer(int id, PlayerInventory inv, PacketBuffer extraData) {
|
public FilterContainer(ContainerType<?> type, int id, PlayerInventory inv, PacketBuffer extraData) {
|
||||||
super(AllContainerTypes.FILTER.type, id, inv, extraData);
|
super(type, id, inv, extraData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FilterContainer(int id, PlayerInventory inv, ItemStack stack) {
|
public FilterContainer(ContainerType<?> type, int id, PlayerInventory inv, ItemStack stack) {
|
||||||
super(AllContainerTypes.FILTER.type, id, inv, stack);
|
super(type, id, inv, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FilterContainer create(int id, PlayerInventory inv, ItemStack stack) {
|
||||||
|
return new FilterContainer(AllContainerTypes.FILTER.get(), id, inv, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -157,9 +157,9 @@ public class FilterItem extends Item implements INamedContainerProvider {
|
||||||
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
||||||
ItemStack heldItem = player.getHeldItemMainhand();
|
ItemStack heldItem = player.getHeldItemMainhand();
|
||||||
if (type == FilterType.REGULAR)
|
if (type == FilterType.REGULAR)
|
||||||
return new FilterContainer(id, inv, heldItem);
|
return FilterContainer.create(id, inv, heldItem);
|
||||||
if (type == FilterType.ATTRIBUTE)
|
if (type == FilterType.ATTRIBUTE)
|
||||||
return new AttributeFilterContainer(id, inv, heldItem);
|
return AttributeFilterContainer.create(id, inv, heldItem);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraftforge.common.Tags;
|
||||||
public class AllPaletteBlocks {
|
public class AllPaletteBlocks {
|
||||||
|
|
||||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||||
.itemGroup(() -> Create.palettesCreativeTab)
|
.itemGroup(() -> Create.PALETTES_CREATIVE_TAB)
|
||||||
.startSection(AllSections.PALETTES);
|
.startSection(AllSections.PALETTES);
|
||||||
|
|
||||||
// Windows and Glass
|
// Windows and Glass
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class ClientSchematicLoader {
|
||||||
Path path = Paths.get("schematics", schematic);
|
Path path = Paths.get("schematics", schematic);
|
||||||
|
|
||||||
if (!Files.exists(path)) {
|
if (!Files.exists(path)) {
|
||||||
Create.logger.fatal("Missing Schematic file: " + path.toString());
|
Create.LOGGER.fatal("Missing Schematic file: " + path.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package com.simibubi.create.content.schematics;
|
package com.simibubi.create.content.schematics;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public interface ISpecialBlockItemRequirement {
|
public interface ISpecialBlockItemRequirement {
|
||||||
|
|
||||||
default ItemRequirement getRequiredItems(BlockState state) {
|
default ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
|
||||||
return ItemRequirement.INVALID;
|
return ItemRequirement.INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@ package com.simibubi.create.content.schematics;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.state.properties.SlabType;
|
import net.minecraft.state.properties.SlabType;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public class ItemRequirement {
|
public class ItemRequirement {
|
||||||
|
|
||||||
|
@ -31,8 +36,17 @@ public class ItemRequirement {
|
||||||
CONSUME, DAMAGE
|
CONSUME, DAMAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemUseType usage;
|
public static class StackRequirement {
|
||||||
List<ItemStack> requiredItems;
|
public final ItemStack item;
|
||||||
|
public final ItemUseType usage;
|
||||||
|
|
||||||
|
public StackRequirement(ItemUseType usage, ItemStack item) {
|
||||||
|
this.item = item;
|
||||||
|
this.usage = usage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<StackRequirement> requiredItems;
|
||||||
|
|
||||||
public static ItemRequirement INVALID = new ItemRequirement();
|
public static ItemRequirement INVALID = new ItemRequirement();
|
||||||
public static ItemRequirement NONE = new ItemRequirement();
|
public static ItemRequirement NONE = new ItemRequirement();
|
||||||
|
@ -40,21 +54,43 @@ public class ItemRequirement {
|
||||||
private ItemRequirement() {
|
private ItemRequirement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemRequirement(ItemUseType usage, Item item) {
|
public ItemRequirement(List<StackRequirement> requiredItems) {
|
||||||
this(usage, Arrays.asList(new ItemStack(item)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemRequirement(ItemUseType usage, List<ItemStack> requiredItems) {
|
|
||||||
this.usage = usage;
|
|
||||||
this.requiredItems = requiredItems;
|
this.requiredItems = requiredItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemRequirement of(BlockState state) {
|
public ItemRequirement(ItemUseType usage, ItemStack items) {
|
||||||
|
this(Arrays.asList(new StackRequirement(usage, items)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemRequirement(ItemUseType usage, Item item) {
|
||||||
|
this(usage, new ItemStack(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemRequirement(ItemUseType usage, List<ItemStack> requiredItems) {
|
||||||
|
this(requiredItems.stream().map(req -> new StackRequirement(usage, req)).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ItemRequirement of(BlockState state, TileEntity te) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
|
||||||
|
ItemRequirement baseRequirement;
|
||||||
|
if (block instanceof ISpecialBlockItemRequirement) {
|
||||||
|
baseRequirement = ((ISpecialBlockItemRequirement) block).getRequiredItems(state, te);
|
||||||
|
} else {
|
||||||
|
baseRequirement = ofBlockState(state, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Behaviours can add additional required items
|
||||||
|
if (te instanceof SmartTileEntity)
|
||||||
|
baseRequirement = baseRequirement.with(((SmartTileEntity) te).getRequiredItems());
|
||||||
|
|
||||||
|
return baseRequirement;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ItemRequirement ofBlockState(BlockState state, Block block) {
|
||||||
if (block == Blocks.AIR)
|
if (block == Blocks.AIR)
|
||||||
return NONE;
|
return NONE;
|
||||||
if (block instanceof ISpecialBlockItemRequirement)
|
|
||||||
return ((ISpecialBlockItemRequirement) block).getRequiredItems(state);
|
|
||||||
|
|
||||||
Item item = BlockItem.BLOCK_TO_ITEM.getOrDefault(state.getBlock(), Items.AIR);
|
Item item = BlockItem.BLOCK_TO_ITEM.getOrDefault(state.getBlock(), Items.AIR);
|
||||||
|
|
||||||
|
@ -125,16 +161,25 @@ public class ItemRequirement {
|
||||||
return INVALID == this;
|
return INVALID == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getRequiredItems() {
|
public List<StackRequirement> getRequiredItems() {
|
||||||
return requiredItems;
|
return requiredItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemUseType getUsage() {
|
|
||||||
return usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean validate(ItemStack required, ItemStack present) {
|
public static boolean validate(ItemStack required, ItemStack present) {
|
||||||
return required.isEmpty() || required.getItem() == present.getItem();
|
return required.isEmpty() || required.getItem() == present.getItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemRequirement with(ItemRequirement other) {
|
||||||
|
if (this.isInvalid() || other.isInvalid())
|
||||||
|
return INVALID;
|
||||||
|
if (this.isEmpty())
|
||||||
|
return other;
|
||||||
|
if (other.isEmpty())
|
||||||
|
return this;
|
||||||
|
|
||||||
|
return new ItemRequirement(
|
||||||
|
Stream.concat(requiredItems.stream(), other.requiredItems.stream()).collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,11 @@ public class MaterialChecklist {
|
||||||
if (requirement.isInvalid())
|
if (requirement.isInvalid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (ItemStack stack : requirement.requiredItems) {
|
for (ItemRequirement.StackRequirement stack : requirement.requiredItems) {
|
||||||
if (requirement.getUsage() == ItemUseType.DAMAGE)
|
if (stack.usage == ItemUseType.DAMAGE)
|
||||||
putOrIncrement(damageRequired, stack);
|
putOrIncrement(damageRequired, stack.item);
|
||||||
if (requirement.getUsage() == ItemUseType.CONSUME)
|
if (stack.usage == ItemUseType.CONSUME)
|
||||||
putOrIncrement(required, stack);
|
putOrIncrement(required, stack.item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
|
||||||
}
|
}
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Create.logger.debug("Could not create TE of block " + blockState + ": " + e);
|
Create.LOGGER.debug("Could not create TE of block " + blockState + ": " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class ServerSchematicLoader {
|
||||||
SchematicUploadEntry entry = activeUploads.get(upload);
|
SchematicUploadEntry entry = activeUploads.get(upload);
|
||||||
|
|
||||||
if (entry.idleTime++ > getConfig().schematicIdleTimeout.get()) {
|
if (entry.idleTime++ > getConfig().schematicIdleTimeout.get()) {
|
||||||
Create.logger.warn("Schematic Upload timed out: " + upload);
|
Create.LOGGER.warn("Schematic Upload timed out: " + upload);
|
||||||
deadEntries.add(upload);
|
deadEntries.add(upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class ServerSchematicLoader {
|
||||||
|
|
||||||
// Unsupported Format
|
// Unsupported Format
|
||||||
if (!schematic.endsWith(".nbt")) {
|
if (!schematic.endsWith(".nbt")) {
|
||||||
Create.logger.warn("Attempted Schematic Upload with non-supported Format: " + playerSchematicId);
|
Create.LOGGER.warn("Attempted Schematic Upload with non-supported Format: " + playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class ServerSchematicLoader {
|
||||||
|
|
||||||
Path uploadPath = playerSchematicsPath.resolve(schematic).normalize();
|
Path uploadPath = playerSchematicsPath.resolve(schematic).normalize();
|
||||||
if (!uploadPath.startsWith(playerSchematicsPath)) {
|
if (!uploadPath.startsWith(playerSchematicsPath)) {
|
||||||
Create.logger.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
|
Create.LOGGER.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public class ServerSchematicLoader {
|
||||||
table.startUpload(schematic);
|
table.startUpload(schematic);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Create.logger.error("Exception Thrown when starting Upload: " + playerSchematicId);
|
Create.LOGGER.error("Exception Thrown when starting Upload: " + playerSchematicId);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,13 +178,13 @@ public class ServerSchematicLoader {
|
||||||
|
|
||||||
// Size Validations
|
// Size Validations
|
||||||
if (data.length > getConfig().maxSchematicPacketSize.get()) {
|
if (data.length > getConfig().maxSchematicPacketSize.get()) {
|
||||||
Create.logger.warn("Oversized Upload Packet received: " + playerSchematicId);
|
Create.LOGGER.warn("Oversized Upload Packet received: " + playerSchematicId);
|
||||||
cancelUpload(playerSchematicId);
|
cancelUpload(playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.bytesUploaded > entry.totalBytes) {
|
if (entry.bytesUploaded > entry.totalBytes) {
|
||||||
Create.logger.warn("Received more data than Expected: " + playerSchematicId);
|
Create.LOGGER.warn("Received more data than Expected: " + playerSchematicId);
|
||||||
cancelUpload(playerSchematicId);
|
cancelUpload(playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class ServerSchematicLoader {
|
||||||
table.sendUpdate = true;
|
table.sendUpdate = true;
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Create.logger.error("Exception Thrown when uploading Schematic: " + playerSchematicId);
|
Create.LOGGER.error("Exception Thrown when uploading Schematic: " + playerSchematicId);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
cancelUpload(playerSchematicId);
|
cancelUpload(playerSchematicId);
|
||||||
}
|
}
|
||||||
|
@ -215,10 +215,10 @@ public class ServerSchematicLoader {
|
||||||
try {
|
try {
|
||||||
entry.stream.close();
|
entry.stream.close();
|
||||||
Files.deleteIfExists(Paths.get(getSchematicPath(), playerSchematicId));
|
Files.deleteIfExists(Paths.get(getSchematicPath(), playerSchematicId));
|
||||||
Create.logger.warn("Cancelled Schematic Upload: " + playerSchematicId);
|
Create.LOGGER.warn("Cancelled Schematic Upload: " + playerSchematicId);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Create.logger.error("Exception Thrown when cancelling Upload: " + playerSchematicId);
|
Create.LOGGER.error("Exception Thrown when cancelling Upload: " + playerSchematicId);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public class ServerSchematicLoader {
|
||||||
World world = removed.world;
|
World world = removed.world;
|
||||||
BlockPos pos = removed.tablePos;
|
BlockPos pos = removed.tablePos;
|
||||||
|
|
||||||
Create.logger.info("New Schematic Uploaded: " + playerSchematicId);
|
Create.LOGGER.info("New Schematic Uploaded: " + playerSchematicId);
|
||||||
if (pos == null)
|
if (pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class ServerSchematicLoader {
|
||||||
table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getGameProfile().getName()));
|
table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getGameProfile().getName()));
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Create.logger.error("Exception Thrown when finishing Upload: " + playerSchematicId);
|
Create.LOGGER.error("Exception Thrown when finishing Upload: " + playerSchematicId);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ public class ServerSchematicLoader {
|
||||||
|
|
||||||
// Unsupported Format
|
// Unsupported Format
|
||||||
if (!schematic.endsWith(".nbt")) {
|
if (!schematic.endsWith(".nbt")) {
|
||||||
Create.logger.warn("Attempted Schematic Upload with non-supported Format: {}", playerSchematicId);
|
Create.LOGGER.warn("Attempted Schematic Upload with non-supported Format: {}", playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ public class ServerSchematicLoader {
|
||||||
|
|
||||||
Path path = schematicPath.resolve(playerSchematicId).normalize();
|
Path path = schematicPath.resolve(playerSchematicId).normalize();
|
||||||
if (!path.startsWith(schematicPath)) {
|
if (!path.startsWith(schematicPath)) {
|
||||||
Create.logger.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
|
Create.LOGGER.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public class ServerSchematicLoader {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Create.logger.error("Exception Thrown in direct Schematic Upload: " + playerSchematicId);
|
Create.LOGGER.error("Exception Thrown in direct Schematic Upload: " + playerSchematicId);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
|
import net.minecraft.inventory.container.ContainerType;
|
||||||
import net.minecraft.inventory.container.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
@ -21,8 +22,8 @@ public class SchematicTableContainer extends Container {
|
||||||
private Slot outputSlot;
|
private Slot outputSlot;
|
||||||
private PlayerEntity player;
|
private PlayerEntity player;
|
||||||
|
|
||||||
public SchematicTableContainer(int id, PlayerInventory inv, PacketBuffer extraData) {
|
public SchematicTableContainer(ContainerType<?> type, int id, PlayerInventory inv, PacketBuffer extraData) {
|
||||||
super(AllContainerTypes.SCHEMATIC_TABLE.type, id);
|
super(type, id);
|
||||||
player = inv.player;
|
player = inv.player;
|
||||||
ClientWorld world = Minecraft.getInstance().world;
|
ClientWorld world = Minecraft.getInstance().world;
|
||||||
TileEntity tileEntity = world.getTileEntity(extraData.readBlockPos());
|
TileEntity tileEntity = world.getTileEntity(extraData.readBlockPos());
|
||||||
|
@ -33,19 +34,23 @@ public class SchematicTableContainer extends Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SchematicTableContainer(int id, PlayerInventory inv, SchematicTableTileEntity te) {
|
public SchematicTableContainer(ContainerType<?> type, int id, PlayerInventory inv, SchematicTableTileEntity te) {
|
||||||
super(AllContainerTypes.SCHEMATIC_TABLE.type, id);
|
super(type, id);
|
||||||
this.player = inv.player;
|
this.player = inv.player;
|
||||||
this.te = te;
|
this.te = te;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SchematicTableContainer create(int id, PlayerInventory inv, SchematicTableTileEntity te) {
|
||||||
|
return new SchematicTableContainer(AllContainerTypes.SCHEMATIC_TABLE.get(), id, inv, te);
|
||||||
|
}
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
inputSlot = new SlotItemHandler(te.inventory, 0, -35, 41) {
|
inputSlot = new SlotItemHandler(te.inventory, 0, -35, 41) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack) {
|
public boolean isItemValid(ItemStack stack) {
|
||||||
return AllItems.EMPTY_SCHEMATIC.isIn(stack) || AllItems.SCHEMATIC_AND_QUILL.isIn(stack)
|
return AllItems.EMPTY_SCHEMATIC.isIn(stack) || AllItems.SCHEMATIC_AND_QUILL.isIn(stack)
|
||||||
|| AllItems.SCHEMATIC.isIn(stack);
|
|| AllItems.SCHEMATIC.isIn(stack);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,16 +68,16 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
||||||
int mainLeft = guiLeft - 56;
|
int mainLeft = guiLeft - 56;
|
||||||
int mainTop = guiTop - 16;
|
int mainTop = guiTop - 16;
|
||||||
|
|
||||||
CreateClient.schematicSender.refresh();
|
CreateClient.SCHEMATIC_SENDER.refresh();
|
||||||
List<ITextComponent> availableSchematics = CreateClient.schematicSender.getAvailableSchematics();
|
List<ITextComponent> availableSchematics = CreateClient.SCHEMATIC_SENDER.getAvailableSchematics();
|
||||||
|
|
||||||
schematicsLabel = new Label(mainLeft + 49, mainTop + 26, StringTextComponent.EMPTY).withShadow();
|
schematicsLabel = new Label(mainLeft + 49, mainTop + 26, StringTextComponent.EMPTY).withShadow();
|
||||||
schematicsLabel.text = StringTextComponent.EMPTY;
|
schematicsLabel.text = StringTextComponent.EMPTY;
|
||||||
if (!availableSchematics.isEmpty()) {
|
if (!availableSchematics.isEmpty()) {
|
||||||
schematicsArea =
|
schematicsArea =
|
||||||
new SelectionScrollInput(mainLeft + 45, mainTop + 21, 139, 18).forOptions(availableSchematics)
|
new SelectionScrollInput(mainLeft + 45, mainTop + 21, 139, 18).forOptions(availableSchematics)
|
||||||
.titled(availableSchematicsTitle.copy())
|
.titled(availableSchematicsTitle.copy())
|
||||||
.writingTo(schematicsLabel);
|
.writingTo(schematicsLabel);
|
||||||
widgets.add(schematicsArea);
|
widgets.add(schematicsArea);
|
||||||
widgets.add(schematicsLabel);
|
widgets.add(schematicsLabel);
|
||||||
}
|
}
|
||||||
|
@ -176,10 +176,10 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
|
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
|
||||||
ClientSchematicLoader schematicSender = CreateClient.schematicSender;
|
ClientSchematicLoader schematicSender = CreateClient.SCHEMATIC_SENDER;
|
||||||
|
|
||||||
if (confirmButton.active && confirmButton.isHovered() && ((SchematicTableContainer) container).canWrite()
|
if (confirmButton.active && confirmButton.isHovered() && ((SchematicTableContainer) container).canWrite()
|
||||||
&& schematicsArea != null) {
|
&& schematicsArea != null) {
|
||||||
|
|
||||||
lastChasingProgress = chasingProgress = progress = 0;
|
lastChasingProgress = chasingProgress = progress = 0;
|
||||||
List<ITextComponent> availableSchematics = schematicSender.getAvailableSchematics();
|
List<ITextComponent> availableSchematics = schematicSender.getAvailableSchematics();
|
||||||
|
|
|
@ -110,8 +110,8 @@ public class SchematicTableTileEntity extends SyncedTileEntity implements ITicka
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) {
|
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
||||||
return new SchematicTableContainer(p_createMenu_1_, p_createMenu_2_, this);
|
return SchematicTableContainer.create(id, inv, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
|
import net.minecraft.inventory.container.ContainerType;
|
||||||
import net.minecraft.inventory.container.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
@ -18,8 +19,8 @@ public class SchematicannonContainer extends Container {
|
||||||
private SchematicannonTileEntity te;
|
private SchematicannonTileEntity te;
|
||||||
private PlayerEntity player;
|
private PlayerEntity player;
|
||||||
|
|
||||||
public SchematicannonContainer(int id, PlayerInventory inv, PacketBuffer buffer) {
|
public SchematicannonContainer(ContainerType<?> type, int id, PlayerInventory inv, PacketBuffer buffer) {
|
||||||
super(AllContainerTypes.SCHEMATICANNON.type, id);
|
super(type, id);
|
||||||
player = inv.player;
|
player = inv.player;
|
||||||
ClientWorld world = Minecraft.getInstance().world;
|
ClientWorld world = Minecraft.getInstance().world;
|
||||||
TileEntity tileEntity = world.getTileEntity(buffer.readBlockPos());
|
TileEntity tileEntity = world.getTileEntity(buffer.readBlockPos());
|
||||||
|
@ -30,13 +31,17 @@ public class SchematicannonContainer extends Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SchematicannonContainer(int id, PlayerInventory inv, SchematicannonTileEntity te) {
|
public SchematicannonContainer(ContainerType<?> type, int id, PlayerInventory inv, SchematicannonTileEntity te) {
|
||||||
super(AllContainerTypes.SCHEMATICANNON.type, id);
|
super(type, id);
|
||||||
player = inv.player;
|
player = inv.player;
|
||||||
this.te = te;
|
this.te = te;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SchematicannonContainer create(int id, PlayerInventory inv, SchematicannonTileEntity te) {
|
||||||
|
return new SchematicannonContainer(AllContainerTypes.SCHEMATICANNON.get(), id, inv, te);
|
||||||
|
}
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
int x = 20;
|
int x = 20;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
||||||
|
@ -28,15 +29,11 @@ import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.NBTProcessors;
|
import com.simibubi.create.foundation.utility.NBTProcessors;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractRailBlock;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.PistonHeadBlock;
|
import net.minecraft.block.PistonHeadBlock;
|
||||||
|
@ -432,17 +429,19 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
boolean shouldSkip = false;
|
boolean shouldSkip = false;
|
||||||
BlockState blockState = Blocks.AIR.getDefaultState();
|
BlockState blockState = Blocks.AIR.getDefaultState();
|
||||||
|
TileEntity tileEntity = null;
|
||||||
ItemRequirement requirement;
|
ItemRequirement requirement;
|
||||||
|
|
||||||
if (entityMode) {
|
if (entityMode) {
|
||||||
requirement = ItemRequirement.of(blockReader.getEntities()
|
requirement = ItemRequirement.of(blockReader.getEntities()
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
.get(printingEntityIndex));
|
.get(printingEntityIndex));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
blockState = BlockHelper.setZeroAge(blockReader.getBlockState(target));
|
blockState = BlockHelper.setZeroAge(blockReader.getBlockState(target));
|
||||||
requirement = ItemRequirement.of(blockState);
|
tileEntity = blockReader.getTileEntity(target);
|
||||||
shouldSkip = !shouldPlace(target, blockState);
|
requirement = ItemRequirement.of(blockState, tileEntity);
|
||||||
|
shouldSkip = !shouldPlace(target, blockState, tileEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldSkip || requirement.isInvalid()) {
|
if (shouldSkip || requirement.isInvalid()) {
|
||||||
|
@ -452,10 +451,10 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find item
|
// Find item
|
||||||
List<ItemStack> requiredItems = requirement.getRequiredItems();
|
List<ItemRequirement.StackRequirement> requiredItems = requirement.getRequiredItems();
|
||||||
if (!requirement.isEmpty()) {
|
if (!requirement.isEmpty()) {
|
||||||
for (ItemStack required : requiredItems) {
|
for (ItemRequirement.StackRequirement required : requiredItems) {
|
||||||
if (!grabItemsFromAttachedInventories(required, requirement.getUsage(), true)) {
|
if (!grabItemsFromAttachedInventories(required.item, required.usage, true)) {
|
||||||
if (skipMissing) {
|
if (skipMissing) {
|
||||||
statusMsg = "skipping";
|
statusMsg = "skipping";
|
||||||
blockSkipped = true;
|
blockSkipped = true;
|
||||||
|
@ -466,15 +465,15 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
missingItem = required;
|
missingItem = required.item;
|
||||||
state = State.PAUSED;
|
state = State.PAUSED;
|
||||||
statusMsg = "missingBlock";
|
statusMsg = "missingBlock";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack required : requiredItems)
|
for (ItemRequirement.StackRequirement required : requiredItems)
|
||||||
grabItemsFromAttachedInventories(required, requirement.getUsage(), false);
|
grabItemsFromAttachedInventories(required.item, required.usage, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Success
|
// Success
|
||||||
|
@ -484,11 +483,11 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
else
|
else
|
||||||
statusMsg = "clearing";
|
statusMsg = "clearing";
|
||||||
|
|
||||||
ItemStack icon = requirement.isEmpty() || requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
|
ItemStack icon = requirement.isEmpty() || requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).item;
|
||||||
if (entityMode)
|
if (entityMode)
|
||||||
launchEntity(target, icon, blockReader.getEntities()
|
launchEntity(target, icon, blockReader.getEntities()
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
.get(printingEntityIndex));
|
.get(printingEntityIndex));
|
||||||
else if (AllBlocks.BELT.has(blockState)) {
|
else if (AllBlocks.BELT.has(blockState)) {
|
||||||
TileEntity te = blockReader.getTileEntity(currentPos.add(schematicAnchor));
|
TileEntity te = blockReader.getTileEntity(currentPos.add(schematicAnchor));
|
||||||
blockState = stripBeltIfNotLast(blockState);
|
blockState = stripBeltIfNotLast(blockState);
|
||||||
|
@ -728,8 +727,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldDeferBlock(BlockState state) {
|
public static boolean shouldDeferBlock(BlockState state) {
|
||||||
Block block = state.getBlock();
|
return state.getBlock().is(AllBlocks.GANTRY_CARRIAGE.get()) || BlockMovementChecks.isBrittle(state);
|
||||||
return block instanceof AbstractRailBlock || block.is(AllBlocks.GANTRY_CARRIAGE.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishedPrinting() {
|
public void finishedPrinting() {
|
||||||
|
@ -759,16 +757,16 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
deferredBlocks.clear();
|
deferredBlocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldPlace(BlockPos pos, BlockState state) {
|
protected boolean shouldPlace(BlockPos pos, BlockState state, TileEntity te) {
|
||||||
if (world == null)
|
if (world == null)
|
||||||
return false;
|
return false;
|
||||||
BlockState toReplace = world.getBlockState(pos);
|
BlockState toReplace = world.getBlockState(pos);
|
||||||
boolean placingAir = state.getBlock()
|
boolean placingAir = state.getBlock()
|
||||||
.isAir(state, world, pos);
|
.isAir(state, world, pos);
|
||||||
|
|
||||||
BlockState toReplaceOther = null;
|
BlockState toReplaceOther = null;
|
||||||
if (state.contains(BlockStateProperties.BED_PART) && state.contains(BlockStateProperties.HORIZONTAL_FACING)
|
if (state.contains(BlockStateProperties.BED_PART) && state.contains(BlockStateProperties.HORIZONTAL_FACING)
|
||||||
&& state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
&& state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
||||||
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
|
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
|
||||||
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||||
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
|
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
|
||||||
|
@ -782,15 +780,15 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
if (toReplace == state)
|
if (toReplace == state)
|
||||||
return false;
|
return false;
|
||||||
if (toReplace.getBlockHardness(world, pos) == -1
|
if (toReplace.getBlockHardness(world, pos) == -1
|
||||||
|| (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
|
|| (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
|
||||||
return false;
|
return false;
|
||||||
if (pos.withinDistance(getPos(), 2f))
|
if (pos.withinDistance(getPos(), 2f))
|
||||||
return false;
|
return false;
|
||||||
if (!replaceTileEntities
|
if (!replaceTileEntities
|
||||||
&& (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
|
&& (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (shouldIgnoreBlockState(state))
|
if (shouldIgnoreBlockState(state, te))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (replaceMode == 3)
|
if (replaceMode == 3)
|
||||||
|
@ -798,23 +796,23 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
if (replaceMode == 2 && !placingAir)
|
if (replaceMode == 2 && !placingAir)
|
||||||
return true;
|
return true;
|
||||||
if (replaceMode == 1
|
if (replaceMode == 1
|
||||||
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos)
|
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos)
|
||||||
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
|
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
|
||||||
&& !placingAir)
|
&& !placingAir)
|
||||||
return true;
|
return true;
|
||||||
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos)
|
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos)
|
||||||
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
|
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldIgnoreBlockState(BlockState state) {
|
protected boolean shouldIgnoreBlockState(BlockState state, TileEntity te) {
|
||||||
// Block doesnt have a mapping (Water, lava, etc)
|
// Block doesnt have a mapping (Water, lava, etc)
|
||||||
if (state.getBlock() == Blocks.STRUCTURE_VOID)
|
if (state.getBlock() == Blocks.STRUCTURE_VOID)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ItemRequirement requirement = ItemRequirement.of(state);
|
ItemRequirement requirement = ItemRequirement.of(state, te);
|
||||||
if (requirement.isEmpty())
|
if (requirement.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
if (requirement.isInvalid())
|
if (requirement.isInvalid())
|
||||||
|
@ -822,7 +820,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
// Block doesnt need to be placed twice (Doors, beds, double plants)
|
// Block doesnt need to be placed twice (Doors, beds, double plants)
|
||||||
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||||
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.UPPER)
|
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.UPPER)
|
||||||
return true;
|
return true;
|
||||||
if (state.contains(BlockStateProperties.BED_PART) && state.get(BlockStateProperties.BED_PART) == BedPart.HEAD)
|
if (state.contains(BlockStateProperties.BED_PART) && state.get(BlockStateProperties.BED_PART) == BedPart.HEAD)
|
||||||
return true;
|
return true;
|
||||||
|
@ -934,7 +932,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
||||||
return new SchematicannonContainer(id, inv, this);
|
return SchematicannonContainer.create(id, inv, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -951,15 +949,17 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
if (schematicLoaded) {
|
if (schematicLoaded) {
|
||||||
blocksToPlace = blocksPlaced;
|
blocksToPlace = blocksPlaced;
|
||||||
for (BlockPos pos : blockReader.getAllPositions()) {
|
for (BlockPos pos : blockReader.getAllPositions()) {
|
||||||
BlockState required = blockReader.getBlockState(pos.add(schematicAnchor));
|
BlockPos relPos = pos.add(schematicAnchor);
|
||||||
|
BlockState required = blockReader.getBlockState(relPos);
|
||||||
|
TileEntity requiredTE = blockReader.getTileEntity(relPos);
|
||||||
|
|
||||||
if (!getWorld().isAreaLoaded(pos.add(schematicAnchor), 0)) {
|
if (!getWorld().isAreaLoaded(pos.add(schematicAnchor), 0)) {
|
||||||
checklist.warnBlockNotLoaded();
|
checklist.warnBlockNotLoaded();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!shouldPlace(pos.add(schematicAnchor), required))
|
if (!shouldPlace(pos.add(schematicAnchor), required, requiredTE))
|
||||||
continue;
|
continue;
|
||||||
ItemRequirement requirement = ItemRequirement.of(required);
|
ItemRequirement requirement = ItemRequirement.of(required, blockReader.getTileEntity(relPos));
|
||||||
if (requirement.isEmpty())
|
if (requirement.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (requirement.isInvalid())
|
if (requirement.isInvalid())
|
||||||
|
|
|
@ -239,7 +239,7 @@ public class SchematicAndQuillHandler {
|
||||||
if (!convertImmediately)
|
if (!convertImmediately)
|
||||||
return;
|
return;
|
||||||
if (!Files.exists(path)) {
|
if (!Files.exists(path)) {
|
||||||
Create.logger.fatal("Missing Schematic file: " + path.toString());
|
Create.LOGGER.fatal("Missing Schematic file: " + path.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -248,14 +248,14 @@ public class SchematicAndQuillHandler {
|
||||||
AllPackets.channel.sendToServer(new InstantSchematicPacket(filename, origin, bounds));
|
AllPackets.channel.sendToServer(new InstantSchematicPacket(filename, origin, bounds));
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Create.logger.fatal("Error finding Schematic file: " + path.toString());
|
Create.LOGGER.fatal("Error finding Schematic file: " + path.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Outliner outliner() {
|
private Outliner outliner() {
|
||||||
return CreateClient.outliner;
|
return CreateClient.OUTLINER;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -50,14 +50,14 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
||||||
setWindowSize(background.width + 50, background.height);
|
setWindowSize(background.width + 50, background.height);
|
||||||
int x = guiLeft;
|
int x = guiLeft;
|
||||||
int y = guiTop;
|
int y = guiTop;
|
||||||
handler = CreateClient.schematicHandler;
|
handler = CreateClient.SCHEMATIC_HANDLER;
|
||||||
|
|
||||||
xInput = new TextFieldWidget(textRenderer, x + 50, y + 26, 34, 10, StringTextComponent.EMPTY);
|
xInput = new TextFieldWidget(textRenderer, x + 50, y + 26, 34, 10, StringTextComponent.EMPTY);
|
||||||
yInput = new TextFieldWidget(textRenderer, x + 90, y + 26, 34, 10, StringTextComponent.EMPTY);
|
yInput = new TextFieldWidget(textRenderer, x + 90, y + 26, 34, 10, StringTextComponent.EMPTY);
|
||||||
zInput = new TextFieldWidget(textRenderer, x + 130, y + 26, 34, 10, StringTextComponent.EMPTY);
|
zInput = new TextFieldWidget(textRenderer, x + 130, y + 26, 34, 10, StringTextComponent.EMPTY);
|
||||||
|
|
||||||
BlockPos anchor = handler.getTransformation()
|
BlockPos anchor = handler.getTransformation()
|
||||||
.getAnchor();
|
.getAnchor();
|
||||||
if (handler.isDeployed()) {
|
if (handler.isDeployed()) {
|
||||||
xInput.setText("" + anchor.getX());
|
xInput.setText("" + anchor.getX());
|
||||||
yInput.setText("" + anchor.getY());
|
yInput.setText("" + anchor.getY());
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (abort.isHovered()) {
|
if (abort.isHovered()) {
|
||||||
CreateClient.schematicAndQuillHandler.discard();
|
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.discard();
|
||||||
Minecraft.getInstance().player.closeScreen();
|
Minecraft.getInstance().player.closeScreen();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void confirm(boolean convertImmediately) {
|
private void confirm(boolean convertImmediately) {
|
||||||
CreateClient.schematicAndQuillHandler.saveSchematic(nameField.getText(), convertImmediately);
|
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.saveSchematic(nameField.getText(), convertImmediately);
|
||||||
Minecraft.getInstance().player.closeScreen();
|
Minecraft.getInstance().player.closeScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
schematicHandler = CreateClient.schematicHandler;
|
schematicHandler = CreateClient.SCHEMATIC_HANDLER;
|
||||||
selectedPos = null;
|
selectedPos = null;
|
||||||
selectedFace = null;
|
selectedFace = null;
|
||||||
schematicSelected = false;
|
schematicSelected = false;
|
||||||
|
|
|
@ -40,10 +40,10 @@ public class InstantSchematicPacket extends SimplePacketBase {
|
||||||
context.get()
|
context.get()
|
||||||
.enqueueWork(() -> {
|
.enqueueWork(() -> {
|
||||||
ServerPlayerEntity player = context.get()
|
ServerPlayerEntity player = context.get()
|
||||||
.getSender();
|
.getSender();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
Create.schematicReceiver.handleInstantSchematic(player, name, player.world, origin, bounds);
|
Create.SCHEMATIC_RECEIVER.handleInstantSchematic(player, name, player.world, origin, bounds);
|
||||||
});
|
});
|
||||||
context.get()
|
context.get()
|
||||||
.setPacketHandled(true);
|
.setPacketHandled(true);
|
||||||
|
|
|
@ -72,13 +72,13 @@ public class SchematicUploadPacket extends SimplePacketBase {
|
||||||
return;
|
return;
|
||||||
if (code == BEGIN) {
|
if (code == BEGIN) {
|
||||||
BlockPos pos = ((SchematicTableContainer) player.openContainer).getTileEntity()
|
BlockPos pos = ((SchematicTableContainer) player.openContainer).getTileEntity()
|
||||||
.getPos();
|
.getPos();
|
||||||
Create.schematicReceiver.handleNewUpload(player, schematic, size, pos);
|
Create.SCHEMATIC_RECEIVER.handleNewUpload(player, schematic, size, pos);
|
||||||
}
|
}
|
||||||
if (code == WRITE)
|
if (code == WRITE)
|
||||||
Create.schematicReceiver.handleWriteRequest(player, schematic, data);
|
Create.SCHEMATIC_RECEIVER.handleWriteRequest(player, schematic, data);
|
||||||
if (code == FINISH)
|
if (code == FINISH)
|
||||||
Create.schematicReceiver.handleFinishedUpload(player, schematic);
|
Create.SCHEMATIC_RECEIVER.handleFinishedUpload(player, schematic);
|
||||||
});
|
});
|
||||||
context.get()
|
context.get()
|
||||||
.setPacketHandled(true);
|
.setPacketHandled(true);
|
||||||
|
|
|
@ -111,9 +111,9 @@ public class ClientEvents {
|
||||||
Backend.tick();
|
Backend.tick();
|
||||||
ScrollValueHandler.tick();
|
ScrollValueHandler.tick();
|
||||||
|
|
||||||
CreateClient.schematicSender.tick();
|
CreateClient.SCHEMATIC_SENDER.tick();
|
||||||
CreateClient.schematicAndQuillHandler.tick();
|
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.tick();
|
||||||
CreateClient.schematicHandler.tick();
|
CreateClient.SCHEMATIC_HANDLER.tick();
|
||||||
|
|
||||||
ContraptionHandler.tick(world);
|
ContraptionHandler.tick(world);
|
||||||
CapabilityMinecartController.tick(world);
|
CapabilityMinecartController.tick(world);
|
||||||
|
@ -138,8 +138,8 @@ public class ClientEvents {
|
||||||
ArmInteractionPointHandler.tick();
|
ArmInteractionPointHandler.tick();
|
||||||
EjectorTargetHandler.tick();
|
EjectorTargetHandler.tick();
|
||||||
PlacementHelpers.tick();
|
PlacementHelpers.tick();
|
||||||
CreateClient.outliner.tickOutlines();
|
CreateClient.OUTLINER.tickOutlines();
|
||||||
CreateClient.ghostBlocks.tickGhosts();
|
CreateClient.GHOST_BLOCKS.tickGhosts();
|
||||||
ContraptionRenderDispatcher.tick();
|
ContraptionRenderDispatcher.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ public class ClientEvents {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onRenderWorld(RenderWorldLastEvent event) {
|
public static void onRenderWorld(RenderWorldLastEvent event) {
|
||||||
Vector3d cameraPos = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
|
Vector3d cameraPos = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
|
||||||
.getProjectedView();
|
.getProjectedView();
|
||||||
float pt = AnimationTickHolder.getPartialTicks();
|
float pt = AnimationTickHolder.getPartialTicks();
|
||||||
|
|
||||||
MatrixStack ms = event.getMatrixStack();
|
MatrixStack ms = event.getMatrixStack();
|
||||||
|
@ -188,10 +188,10 @@ public class ClientEvents {
|
||||||
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
|
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
|
||||||
|
|
||||||
CouplingRenderer.renderAll(ms, buffer);
|
CouplingRenderer.renderAll(ms, buffer);
|
||||||
CreateClient.schematicHandler.render(ms, buffer);
|
CreateClient.SCHEMATIC_HANDLER.render(ms, buffer);
|
||||||
CreateClient.ghostBlocks.renderAll(ms, buffer);
|
CreateClient.GHOST_BLOCKS.renderAll(ms, buffer);
|
||||||
|
|
||||||
CreateClient.outliner.renderOutlines(ms, buffer, pt);
|
CreateClient.OUTLINER.renderOutlines(ms, buffer, pt);
|
||||||
// LightVolumeDebugger.render(ms, buffer);
|
// LightVolumeDebugger.render(ms, buffer);
|
||||||
buffer.draw();
|
buffer.draw();
|
||||||
RenderSystem.enableCull();
|
RenderSystem.enableCull();
|
||||||
|
@ -221,7 +221,7 @@ public class ClientEvents {
|
||||||
|
|
||||||
public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay,
|
public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay,
|
||||||
float partialTicks) {
|
float partialTicks) {
|
||||||
CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
CreateClient.SCHEMATIC_HANDLER.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.simibubi.create.content.contraptions.fluids.recipe.PotionMixingRecipe
|
||||||
import com.simibubi.create.content.contraptions.wrench.WrenchItem;
|
import com.simibubi.create.content.contraptions.wrench.WrenchItem;
|
||||||
import com.simibubi.create.content.curiosities.zapper.ZapperInteractionHandler;
|
import com.simibubi.create.content.curiosities.zapper.ZapperInteractionHandler;
|
||||||
import com.simibubi.create.content.curiosities.zapper.ZapperItem;
|
import com.simibubi.create.content.curiosities.zapper.ZapperItem;
|
||||||
import com.simibubi.create.content.schematics.ServerSchematicLoader;
|
|
||||||
import com.simibubi.create.foundation.command.AllCommands;
|
import com.simibubi.create.foundation.command.AllCommands;
|
||||||
import com.simibubi.create.foundation.fluid.FluidHelper;
|
import com.simibubi.create.foundation.fluid.FluidHelper;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
@ -54,10 +53,8 @@ public class CommonEvents {
|
||||||
public static void onServerTick(ServerTickEvent event) {
|
public static void onServerTick(ServerTickEvent event) {
|
||||||
if (event.phase == Phase.START)
|
if (event.phase == Phase.START)
|
||||||
return;
|
return;
|
||||||
if (Create.schematicReceiver == null)
|
Create.SCHEMATIC_RECEIVER.tick();
|
||||||
Create.schematicReceiver = new ServerSchematicLoader();
|
Create.LAGGER.tick();
|
||||||
Create.schematicReceiver.tick();
|
|
||||||
Create.lagger.tick();
|
|
||||||
ServerSpeedProvider.serverTick();
|
ServerSpeedProvider.serverTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,21 +130,21 @@ public class CommonEvents {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void serverStopped(FMLServerStoppingEvent event) {
|
public static void serverStopped(FMLServerStoppingEvent event) {
|
||||||
Create.schematicReceiver.shutdown();
|
Create.SCHEMATIC_RECEIVER.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onLoadWorld(WorldEvent.Load event) {
|
public static void onLoadWorld(WorldEvent.Load event) {
|
||||||
IWorld world = event.getWorld();
|
IWorld world = event.getWorld();
|
||||||
Create.redstoneLinkNetworkHandler.onLoadWorld(world);
|
Create.REDSTONE_LINK_NETWORK_HANDLER.onLoadWorld(world);
|
||||||
Create.torquePropagator.onLoadWorld(world);
|
Create.TORQUE_PROPAGATOR.onLoadWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onUnloadWorld(WorldEvent.Unload event) {
|
public static void onUnloadWorld(WorldEvent.Unload event) {
|
||||||
IWorld world = event.getWorld();
|
IWorld world = event.getWorld();
|
||||||
Create.redstoneLinkNetworkHandler.onUnloadWorld(world);
|
Create.REDSTONE_LINK_NETWORK_HANDLER.onUnloadWorld(world);
|
||||||
Create.torquePropagator.onUnloadWorld(world);
|
Create.TORQUE_PROPAGATOR.onUnloadWorld(world);
|
||||||
WorldAttached.invalidateWorld(world);
|
WorldAttached.invalidateWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class InputEvents {
|
||||||
if (Minecraft.getInstance().currentScreen != null)
|
if (Minecraft.getInstance().currentScreen != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CreateClient.schematicHandler.onKeyInput(key, pressed);
|
CreateClient.SCHEMATIC_HANDLER.onKeyInput(key, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@ -33,9 +33,9 @@ public class InputEvents {
|
||||||
|
|
||||||
double delta = event.getScrollDelta();
|
double delta = event.getScrollDelta();
|
||||||
// CollisionDebugger.onScroll(delta);
|
// CollisionDebugger.onScroll(delta);
|
||||||
boolean cancelled = CreateClient.schematicHandler.mouseScrolled(delta)
|
boolean cancelled = CreateClient.SCHEMATIC_HANDLER.mouseScrolled(delta)
|
||||||
|| CreateClient.schematicAndQuillHandler.mouseScrolled(delta) || FilteringHandler.onScroll(delta)
|
|| CreateClient.SCHEMATIC_AND_QUILL_HANDLER.mouseScrolled(delta) || FilteringHandler.onScroll(delta)
|
||||||
|| ScrollValueHandler.onScroll(delta);
|
|| ScrollValueHandler.onScroll(delta);
|
||||||
event.setCanceled(cancelled);
|
event.setCanceled(cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ public class InputEvents {
|
||||||
int button = event.getButton();
|
int button = event.getButton();
|
||||||
boolean pressed = !(event.getAction() == 0);
|
boolean pressed = !(event.getAction() == 0);
|
||||||
|
|
||||||
CreateClient.schematicHandler.onMouseInput(button, pressed);
|
CreateClient.SCHEMATIC_HANDLER.onMouseInput(button, pressed);
|
||||||
CreateClient.schematicAndQuillHandler.onMouseInput(button, pressed);
|
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.onMouseInput(button, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public interface ITE<T extends TileEntity> {
|
||||||
|
|
||||||
static void report(TileEntityException e) {
|
static void report(TileEntityException e) {
|
||||||
if (AllConfigs.COMMON.logTeErrors.get())
|
if (AllConfigs.COMMON.logTeErrors.get())
|
||||||
Create.logger.debug("TileEntityException thrown!", e);
|
Create.LOGGER.debug("TileEntityException thrown!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue