Bug Fixes in 0.1.1a

- Fixed id downcasing not working properly in non-english environments #25
- Removed event subscriber annotations for mod & registry events
- Added more displayable slots in the Washing JEI view
- Fixed Windowed blocks referencing IBakedModel on the server
- Changed stairs to use blockstate supplier
- Fixed Symmetry Wand crashing when configured in the off-hand
- Fixed "Hold Shift" in tooltips not being translated
- Chassis now drop applied slime balls
- Slime Balls are now craftable
- Mechanical Belts now lock living entities in place
- Blockzapper recipes can now be viewed from the uses of their ingredient materials
- Configured FlexPeaters now synchronize with other players
- Fixed client crash when rendering lava in a deployed schematic #15
- Made encased fans a little less expensive
- Added other coral types to tree fertilizer recipe
This commit is contained in:
simibubi 2019-10-15 22:22:19 +02:00
parent 7822ba7a42
commit facef0ddb1
43 changed files with 306 additions and 276 deletions

View file

@ -13,14 +13,14 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = 'mc1.14.4_v0.1.1'
version = 'mc1.14.4_v0.1.1a'
group = 'com.simibubi.create'
archivesBaseName = 'create'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
mappings channel: 'snapshot', version: '20190917-1.14.3'
mappings channel: 'snapshot', version: '20191012-1.14.3'
runs {
client {
@ -71,12 +71,12 @@ repositories {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.14.4-28.1.6'
minecraft 'net.minecraftforge:forge:1.14.4-28.1.45'
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.10:api")
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.18:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.10")
//runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.18")
}
jar {

View file

@ -1,5 +1,7 @@
package com.simibubi.create;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.tags.BlockTags;
@ -8,10 +10,8 @@ import net.minecraft.util.ResourceLocation;
public enum AllBlockTags {
WINDMILL_SAILS,
FAN_HEATERS,
WINDOWABLE,
WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE,
;
public Tag<Block> tag;
@ -22,9 +22,9 @@ public enum AllBlockTags {
private AllBlockTags(String path) {
tag = new BlockTags.Wrapper(
new ResourceLocation(Create.ID, (path.isEmpty() ? "" : path + "/") + name().toLowerCase()));
new ResourceLocation(Create.ID, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())));
}
public boolean matches(BlockState block) {
return tag.contains(block.getBlock());
}

View file

@ -5,6 +5,7 @@ import com.simibubi.create.foundation.block.IWithoutBlockItem;
import com.simibubi.create.foundation.block.ProperStairsBlock;
import com.simibubi.create.foundation.block.RenderUtilityAxisBlock;
import com.simibubi.create.foundation.block.RenderUtilityBlock;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.IModule;
import com.simibubi.create.modules.contraptions.generators.MotorBlock;
import com.simibubi.create.modules.contraptions.generators.WaterWheelBlock;
@ -182,14 +183,14 @@ public enum AllBlocks {
CategoryTracker.currentModule = new IModule() {
@Override
public String getModuleName() {
return name().toLowerCase().replaceAll("__", "");
return Lang.asId(name()).replaceAll("__", "");
}
};
}
private AllBlocks(Block block, ComesWith... comesWith) {
this.block = block;
this.block.setRegistryName(Create.ID, this.name().toLowerCase());
this.block.setRegistryName(Create.ID, Lang.asId(name()));
this.module = CategoryTracker.currentModule;
alsoRegistered = new Block[comesWith.length];
@ -259,7 +260,7 @@ public enum AllBlocks {
}
return featured.setRegistryName(Create.ID,
block.getRegistryName().getPath() + "_" + feature.name().toLowerCase());
block.getRegistryName().getPath() + "_" + Lang.asId(feature.name()));
}
@OnlyIn(Dist.CLIENT)

View file

@ -1,5 +1,6 @@
package com.simibubi.create;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.logistics.block.FlexcrateContainer;
import com.simibubi.create.modules.logistics.block.FlexcrateScreen;
import com.simibubi.create.modules.schematics.block.SchematicTableContainer;
@ -17,19 +18,15 @@ 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.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.network.IContainerFactory;
import net.minecraftforge.registries.IForgeRegistry;
@EventBusSubscriber(bus = Bus.MOD)
public enum AllContainers {
SCHEMATIC_TABLE(SchematicTableContainer::new),
SCHEMATIC_TABLE(SchematicTableContainer::new),
SCHEMATICANNON(SchematicannonContainer::new),
FLEXCRATE(FlexcrateContainer::new),
;
public ContainerType<? extends Container> type;
@ -39,13 +36,11 @@ public enum AllContainers {
this.factory = factory;
}
@SubscribeEvent
public static void onContainerTypeRegistry(final RegistryEvent.Register<ContainerType<?>> e) {
public static void registerContainers(IForgeRegistry<ContainerType<?>> iForgeRegistry) {
for (AllContainers container : values()) {
container.type = new ContainerType<>(container.factory)
.setRegistryName(new ResourceLocation(Create.ID, container.name().toLowerCase()));
e.getRegistry().register(container.type);
.setRegistryName(new ResourceLocation(Create.ID, Lang.asId(container.name())));
iForgeRegistry.register(container.type);
}
}
@ -58,7 +53,8 @@ public enum AllContainers {
@OnlyIn(Dist.CLIENT)
@SuppressWarnings("unchecked")
private static <C extends Container, S extends Screen & IHasContainer<C>> void bind(AllContainers c, IScreenFactory<C, S> factory) {
private static <C extends Container, S extends Screen & IHasContainer<C>> void bind(AllContainers c,
IScreenFactory<C, S> factory) {
ScreenManager.registerFactory((ContainerType<C>) c.type, factory);
}

View file

@ -1,5 +1,7 @@
package com.simibubi.create;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.ItemTags;
@ -13,11 +15,11 @@ public enum AllItemTags {
public Tag<Item> tag;
private AllItemTags(String path) {
tag = new ItemTags.Wrapper(new ResourceLocation(Create.ID, path + "/" + name().toLowerCase()));
tag = new ItemTags.Wrapper(new ResourceLocation(Create.ID, path + "/" + Lang.asId(name())));
}
public boolean matches(ItemStack item) {
return tag.contains(item.getItem());
}
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create;
import com.simibubi.create.foundation.item.IItemWithColorHandler;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.IModule;
import com.simibubi.create.modules.contraptions.relays.VerticalGearboxItem;
import com.simibubi.create.modules.contraptions.relays.belt.BeltItem;
@ -91,14 +92,14 @@ public enum AllItems {
CategoryTracker.currentModule = new IModule() {
@Override
public String getModuleName() {
return name().toLowerCase().replaceAll("__", "");
return Lang.asId(name()).replaceAll("__", "");
}
};
}
private AllItems(Item item) {
this.item = item;
this.item.setRegistryName(Create.ID, this.name().toLowerCase());
this.item.setRegistryName(Create.ID, Lang.asId(name()));
this.module = CategoryTracker.currentModule;
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create;
import java.util.function.Supplier;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.ProcessingRecipeSerializer;
import com.simibubi.create.modules.contraptions.receivers.CrushingRecipe;
import com.simibubi.create.modules.contraptions.receivers.PressingRecipe;
@ -52,7 +53,7 @@ public enum AllRecipes {
public static void register(RegistryEvent.Register<IRecipeSerializer<?>> event) {
for (AllRecipes r : AllRecipes.values()) {
r.serializer = r.supplier.get();
ResourceLocation location = new ResourceLocation(Create.ID, r.name().toLowerCase());
ResourceLocation location = new ResourceLocation(Create.ID, Lang.asId(r.name()));
event.getRegistry().register(r.serializer.setRegistryName(location));
}
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create;
import java.util.function.Supplier;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.generators.MotorTileEntity;
import com.simibubi.create.modules.contraptions.generators.MotorTileEntityRenderer;
@ -54,13 +55,9 @@ import net.minecraft.tileentity.TileEntityType;
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.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.IForgeRegistry;
@Mod.EventBusSubscriber(bus = Bus.MOD)
public enum AllTileEntities {
// Schematics
@ -95,7 +92,7 @@ public enum AllTileEntities {
BELT_FUNNEL(BeltFunnelTileEntity::new, AllBlocks.BELT_FUNNEL),
ENTITY_DETECTOR(EntityDetectorTileEntity::new, AllBlocks.ENTITY_DETECTOR),
FLEXPEATER(FlexpeaterTileEntity::new, AllBlocks.FLEXPEATER),
// Curiosities
WINDOW_IN_A_BLOCK(WindowInABlockTileEntity::new, AllBlocks.WINDOW_IN_A_BLOCK),
@ -110,18 +107,16 @@ public enum AllTileEntities {
this.blocks = blocks;
}
@SubscribeEvent
public static void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> event) {
public static void registerTileEntities(IForgeRegistry<TileEntityType<?>> registry) {
for (AllTileEntities tileEntity : values()) {
Block[] blocks = new Block[tileEntity.blocks.length];
for (int i = 0; i < blocks.length; i++)
blocks[i] = tileEntity.blocks[i].block;
ResourceLocation resourceLocation = new ResourceLocation(Create.ID, tileEntity.name().toLowerCase());
ResourceLocation resourceLocation = new ResourceLocation(Create.ID, Lang.asId(tileEntity.name()));
tileEntity.type = TileEntityType.Builder.create(tileEntity.supplier, blocks).build(null)
.setRegistryName(resourceLocation);
event.getRegistry().register(tileEntity.type);
registry.register(tileEntity.type);
}
}

View file

@ -9,20 +9,20 @@ import com.simibubi.create.modules.logistics.FrequencyHandler;
import com.simibubi.create.modules.schematics.ServerSchematicLoader;
import net.minecraft.block.Block;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@EventBusSubscriber(bus = Bus.MOD)
@Mod(Create.ID)
public class Create {
@ -39,11 +39,20 @@ public class Create {
public static ModConfig config;
public Create() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(Create::init);
modEventBus.addGenericListener(Block.class, Create::registerBlocks);
modEventBus.addGenericListener(Item.class, Create::registerItems);
modEventBus.addGenericListener(IRecipeSerializer.class, Create::registerRecipes);
modEventBus.addGenericListener(TileEntityType.class, Create::registerTileEntities);
modEventBus.addGenericListener(ContainerType.class, Create::registerContainers);
modEventBus.addListener(Create::createConfigs);
CreateClient.addListeners(modEventBus);
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, CreateConfig.specification);
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CreateClientConfig.specification);
}
@SubscribeEvent
public static void init(final FMLCommonSetupEvent event) {
schematicReceiver = new ServerSchematicLoader();
frequencyHandler = new FrequencyHandler();
@ -52,23 +61,27 @@ public class Create {
AllPackets.registerPackets();
}
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
AllItems.registerItems(event.getRegistry());
AllBlocks.registerItemBlocks(event.getRegistry());
}
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
AllBlocks.registerBlocks(event.getRegistry());
}
@SubscribeEvent
public static void registerTileEntities(RegistryEvent.Register<TileEntityType<?>> event) {
AllTileEntities.registerTileEntities(event.getRegistry());
}
public static void registerContainers(RegistryEvent.Register<ContainerType<?>> event) {
AllContainers.registerContainers(event.getRegistry());
}
public static void registerRecipes(RegistryEvent.Register<IRecipeSerializer<?>> event) {
AllRecipes.register(event);
}
@SubscribeEvent
public static void createConfigs(ModConfig.ModConfigEvent event) {
if (event.getConfig().getSpec() == CreateClientConfig.specification)
return;

View file

@ -24,13 +24,11 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@EventBusSubscriber(bus = Bus.MOD)
public class CreateClient {
public static ClientSchematicLoader schematicSender;
@ -41,7 +39,14 @@ public class CreateClient {
public static ModConfig config;
@SubscribeEvent
public static void addListeners(IEventBus modEventBus) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
modEventBus.addListener(CreateClient::clientInit);
modEventBus.addListener(CreateClient::createConfigs);
modEventBus.addListener(CreateClient::onModelBake);
});
}
public static void clientInit(FMLClientSetupEvent event) {
schematicSender = new ClientSchematicLoader();
schematicHandler = new SchematicHandler();
@ -60,7 +65,6 @@ public class CreateClient {
((IReloadableResourceManager) resourceManager).addReloadListener(new CachedBufferReloader());
}
@SubscribeEvent
public static void createConfigs(ModConfig.ModConfigEvent event) {
if (event.getConfig().getSpec() == CreateConfig.specification)
return;
@ -75,7 +79,6 @@ public class CreateClient {
schematicHologram.tick();
}
@SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void onModelBake(ModelBakeEvent event) {
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
@ -111,4 +114,6 @@ public class CreateClient {
modelRegistry.put(location, factory.apply(modelRegistry.get(location)));
}
}

View file

@ -38,6 +38,7 @@ public enum ScreenResources {
BLOCKZAPPER_UPGRADE_RECIPE("recipes2.png", 144, 66),
PRESSER_RECIPE("recipes2.png", 0, 108, 177, 109),
WASHING_RECIPE("recipes3.png", 177, 109),
PROCESSING_RECIPE_SLOT("recipes3.png", 177, 0, 20, 20),
// Widgets
PALETTE_BUTTON("palette_picker.png", 0, 236, 20, 20),

View file

@ -109,7 +109,7 @@ public class BlockzapperUpgradeCategory implements IRecipeCategory<BuilderGunUpg
public void draw(BuilderGunUpgradeRecipe recipe, double mouseX, double mouseY) {
FontRenderer font = Minecraft.getInstance().fontRenderer;
String componentName = Lang
.translate("blockzapper.component." + recipe.getUpgradedComponent().name().toLowerCase());
.translate("blockzapper.component." + Lang.asId(recipe.getUpgradedComponent().name()));
String text = "+ " + recipe.getTier().color + componentName;
font.drawStringWithShadow(text,
(BLOCKZAPPER_UPGRADE_RECIPE.width - font.getStringWidth(text)) / 2, 57, 0x8B8B8B);

View file

@ -29,12 +29,14 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
private static ResourceLocation ID = new ResourceLocation(Create.ID, "splashing");
private IDrawable icon;
private IDrawable slot;
public SplashingCategory() {
slot = new ScreenResourceWrapper(ScreenResources.PROCESSING_RECIPE_SLOT);
icon = new DoubleItemIcon(() -> new ItemStack(AllItems.PROPELLER.get()),
() -> new ItemStack(Items.WATER_BUCKET));
}
@Override
public IDrawable getIcon() {
return icon;
@ -54,7 +56,7 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
public String getTitle() {
return Lang.translate("recipe.splashing");
}
@Override
public void setIngredients(SplashingRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients());
@ -69,7 +71,10 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
List<StochasticOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
itemStacks.init(outputIndex + 1, false, 139, 58 + 19 * outputIndex);
int xOffset = outputIndex % 2 == 0 ? 0 : 19;
int yOffset = (outputIndex / 2) * -19;
itemStacks.init(outputIndex + 1, false, 132 + xOffset, 77 + yOffset);
itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack());
}
@ -88,6 +93,17 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
return new ScreenResourceWrapper(ScreenResources.WASHING_RECIPE);
}
@Override
public void draw(SplashingRecipe recipe, double mouseX, double mouseY) {
super.draw(recipe, mouseX, mouseY);
int size = recipe.getPossibleOutputs().size();
for (int i = 4; i < size; i++) {
int xOffset = i % 2 == 0 ? 0 : 19;
int yOffset = (i / 2) * -19;
slot.draw(131 + xOffset, 76 + yOffset);
}
}
@Override
public void renderAttachedBlock() {
BlockState state = Blocks.WATER.getDefaultState().with(FlowingFluidBlock.LEVEL, 8);

View file

@ -6,7 +6,7 @@ import net.minecraft.block.StairsBlock;
public class ProperStairsBlock extends StairsBlock {
public ProperStairsBlock(Block block) {
super(block.getDefaultState(), Properties.from(block));
super(() -> block.getDefaultState(), Properties.from(block));
}
}

View file

@ -5,30 +5,36 @@ import java.util.function.Supplier;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.Hand;
import net.minecraftforge.fml.network.NetworkEvent.Context;
public class NbtPacket extends SimplePacketBase {
public ItemStack stack;
public int slot;
public Hand hand;
public NbtPacket(ItemStack stack) {
public NbtPacket(ItemStack stack, Hand hand) {
this(stack, -1);
this.hand = hand;
}
public NbtPacket(ItemStack stack, int slot) {
this.stack = stack;
this.slot = slot;
this.hand = Hand.MAIN_HAND;
}
public NbtPacket(PacketBuffer buffer) {
stack = buffer.readItemStack();
slot = buffer.readInt();
hand = Hand.values()[buffer.readInt()];
}
public void write(PacketBuffer buffer) {
buffer.writeItemStack(stack);
buffer.writeInt(slot);
buffer.writeInt(hand.ordinal());
}
public void handle(Supplier<Context> context) {
@ -36,15 +42,7 @@ public class NbtPacket extends SimplePacketBase {
ServerPlayerEntity player = context.get().getSender();
if (slot == -1) {
ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem.getItem() == stack.getItem()) {
heldItem.setTag(stack.getTag());
}
return;
}
if (slot == -2) {
ItemStack heldItem = player.getHeldItemOffhand();
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem.getItem() == stack.getItem()) {
heldItem.setTag(stack.getTag());
}

View file

@ -26,7 +26,7 @@ public class FilesHelper {
Path path = Paths.get(name);
if (path.getParent() != null)
createFolderIfMissing(path.getParent().toString());
if (!Files.isDirectory(path)) {
try {
Files.createDirectory(path);
@ -49,7 +49,7 @@ public class FilesHelper {
}
public static String slug(String name) {
return name.toLowerCase().replace(' ', '_').replace('!', '_').replace('?', '_');
return Lang.asId(name).replace(' ', '_').replace('!', '_').replace('?', '_');
}
public static boolean saveTagCompoundAsJson(CompoundNBT compound, String path) {
@ -65,7 +65,6 @@ public class FilesHelper {
}
return false;
}
public static boolean saveTagCompoundAsJsonCompact(CompoundNBT compound, String path) {
try {
@ -78,7 +77,7 @@ public class FilesHelper {
e.printStackTrace();
}
return false;
}
public static CompoundNBT loadJsonNBT(InputStream inputStream) {
@ -110,5 +109,4 @@ public class FilesHelper {
return null;
}
}

View file

@ -85,19 +85,41 @@ public class ItemDescription {
boolean hasControls = !linesOnCtrl.isEmpty();
if (hasDescription || hasControls) {
String[] holdKey = Lang.translate("tooltip.holdKey", "$").split("\\$");
String[] holdKeyOrKey = Lang.translate("tooltip.holdKeyOrKey", "$", "$").split("\\$");
String keyShift = Lang.translate("tooltip.keyShift");
String keyCtrl = Lang.translate("tooltip.keyCtrl");
for (List<ITextComponent> list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) {
boolean shift = list == linesOnShift;
boolean ctrl = list == linesOnCtrl;
String tabs = DARK_GRAY + "Hold ";
if (hasDescription)
tabs += "<" + (shift ? palette.hColor : palette.color) + "Shift" + DARK_GRAY + ">";
if (hasDescription && hasControls)
tabs += " or ";
if (hasControls)
tabs += "<" + (ctrl ? palette.hColor : palette.color) + "Control" + DARK_GRAY + ">";
if (holdKey.length != 2 || holdKeyOrKey.length != 3) {
list.add(0, new StringTextComponent("Invalid lang formatting!"));
continue;
}
list.add(0, new StringTextComponent(tabs));
StringBuilder tabBuilder = new StringBuilder();
tabBuilder.append(DARK_GRAY);
if (hasDescription && hasControls) {
tabBuilder.append(holdKeyOrKey[0]);
tabBuilder.append(shift ? palette.hColor : palette.color);
tabBuilder.append(keyShift);
tabBuilder.append(DARK_GRAY);
tabBuilder.append(holdKeyOrKey[1]);
tabBuilder.append(ctrl ? palette.hColor : palette.color);
tabBuilder.append(keyCtrl);
tabBuilder.append(DARK_GRAY);
tabBuilder.append(holdKeyOrKey[2]);
} else {
tabBuilder.append(holdKey[0]);
tabBuilder.append((hasDescription ? shift : ctrl) ? palette.hColor : palette.color);
tabBuilder.append(hasDescription ? keyShift : keyCtrl);
tabBuilder.append(DARK_GRAY);
tabBuilder.append(holdKey[1]);
}
list.add(0, new StringTextComponent(tabBuilder.toString()));
if (shift || ctrl)
list.add(1, new StringTextComponent(""));
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import com.simibubi.create.Create;
@ -30,4 +31,8 @@ public class Lang {
return result;
}
public static String asId(String name) {
return name.toLowerCase(Locale.ENGLISH);
}
}

View file

@ -4,25 +4,30 @@ import com.simibubi.create.foundation.block.IBlockWithScrollableValue;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.RotatedPillarBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.BooleanProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.Tags;
public abstract class AbstractChassisBlock extends RotatedPillarBlock
implements IWithTileEntity<ChassisTileEntity>, IBlockWithScrollableValue {
private static final Vec3d valuePos = new Vec3d(15 / 16f, 9 / 16f, 9 / 16f);
public AbstractChassisBlock(Properties properties) {
@ -50,16 +55,24 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock
return false;
ItemStack heldItem = player.getHeldItem(handIn);
boolean isSlimeBall = heldItem.isItemEqual(new ItemStack(Items.SLIME_BALL));
boolean isSlimeBall = heldItem.getItem().isIn(Tags.Items.SLIMEBALLS);
if ((!heldItem.isEmpty() || !player.isSneaking()) && !isSlimeBall)
return false;
if (state.get(affectedSide) == isSlimeBall)
return false;
if (worldIn.isRemote)
if (worldIn.isRemote) {
Vec3d vec = hit.getHitVec();
worldIn.addParticle(ParticleTypes.ITEM_SLIME, vec.x, vec.y, vec.z, 0, 0, 0);
return true;
}
worldIn.playSound(null, pos, SoundEvents.BLOCK_SLIME_BLOCK_PLACE, SoundCategory.BLOCKS, .5f, 1);
if (isSlimeBall && !player.isCreative())
heldItem.shrink(1);
if (!isSlimeBall && !player.isCreative())
Block.spawnAsEntity(worldIn, pos.offset(hit.getFace()), new ItemStack(Items.SLIME_BALL));
worldIn.setBlockState(pos, state.with(affectedSide, isSlimeBall));
return true;
}
@ -78,17 +91,17 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock
public String getValueName(BlockState state, IWorld world, BlockPos pos) {
return Lang.translate("generic.range");
}
@Override
public Vec3d getValueBoxPosition(BlockState state, IWorld world, BlockPos pos) {
return valuePos;
}
@Override
public Direction getValueBoxDirection(BlockState state, IWorld world, BlockPos pos) {
return null;
}
@Override
public boolean isValueOnAllSides() {
return true;

View file

@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticBlock;
@ -145,7 +146,7 @@ public class MechanicalPistonBlock extends KineticBlock {
@Override
public String getName() {
return name().toLowerCase();
return Lang.asId(name());
}
}

View file

@ -7,6 +7,7 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.IWithoutBlockItem;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity.TransportedEntityInfo;
@ -325,7 +326,7 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt
@Override
public String getName() {
return name().toLowerCase();
return Lang.asId(name());
}
}
@ -334,7 +335,7 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt
@Override
public String getName() {
return name().toLowerCase();
return Lang.asId(name());
}
}

View file

@ -23,6 +23,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
@ -196,9 +198,10 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn
if (entityIn.posY - .25f < pos.getY())
return;
// Not sure if this does anything
if (entityIn instanceof LivingEntity)
((LivingEntity) entityIn).setIdleTime(101);
// Lock entities in place
if (entityIn instanceof LivingEntity && !(entityIn instanceof PlayerEntity)) {
((LivingEntity) entityIn).addPotionEffect(new EffectInstance(Effects.SLOWNESS, 1, 9, false, false));
}
BeltTileEntity belt = (BeltTileEntity) te;

View file

@ -1,5 +1,9 @@
package com.simibubi.create.modules.curiosities.partialWindows;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity.PARTIAL_BLOCK;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity.POSITION;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity.WINDOW_BLOCK;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@ -23,14 +27,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelProperty;
public class WindowInABlockModel extends WrappedBakedModel {
public static final ModelProperty<BlockState> PARTIAL_BLOCK = new ModelProperty<>();
public static final ModelProperty<BlockState> WINDOW_BLOCK = new ModelProperty<>();
public static final ModelProperty<BlockPos> POSITION = new ModelProperty<>();
public WindowInABlockModel(IBakedModel template) {
super(template);
}
@ -46,7 +45,7 @@ public class WindowInABlockModel extends WrappedBakedModel {
if (partialState == null || windowState == null)
return dispatcher.getModelForState(Blocks.DIRT.getDefaultState()).getQuads(state, side, rand, data);
BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer();
if (partialState.canRenderInLayer(renderLayer) && partialState != null) {
quads.addAll(dispatcher.getModelForState(partialState).getQuads(partialState, side, rand, data));

View file

@ -1,8 +1,5 @@
package com.simibubi.create.modules.curiosities.partialWindows;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockModel.PARTIAL_BLOCK;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockModel.WINDOW_BLOCK;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.SyncedTileEntity;
@ -14,18 +11,22 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
public class WindowInABlockTileEntity extends SyncedTileEntity {
private BlockState partialBlock = Blocks.AIR.getDefaultState();
private BlockState windowBlock = Blocks.AIR.getDefaultState();
private IModelData modelData;
public static final ModelProperty<BlockState> PARTIAL_BLOCK = new ModelProperty<>();
public static final ModelProperty<BlockState> WINDOW_BLOCK = new ModelProperty<>();
public static final ModelProperty<BlockPos> POSITION = new ModelProperty<>();
public WindowInABlockTileEntity() {
super(AllTileEntities.WINDOW_IN_A_BLOCK.type);
modelData = new ModelDataMap.Builder().withInitial(WINDOW_BLOCK, Blocks.AIR.getDefaultState())
.withInitial(PARTIAL_BLOCK, Blocks.AIR.getDefaultState())
.withInitial(WindowInABlockModel.POSITION, BlockPos.ZERO).build();
.withInitial(PARTIAL_BLOCK, Blocks.AIR.getDefaultState()).withInitial(POSITION, BlockPos.ZERO).build();
}
@Override
@ -59,9 +60,9 @@ public class WindowInABlockTileEntity extends SyncedTileEntity {
@Override
public IModelData getModelData() {
modelData.setData(WindowInABlockModel.PARTIAL_BLOCK, partialBlock);
modelData.setData(WindowInABlockModel.WINDOW_BLOCK, windowBlock);
modelData.setData(WindowInABlockModel.POSITION, pos);
modelData.setData(PARTIAL_BLOCK, partialBlock);
modelData.setData(WINDOW_BLOCK, windowBlock);
modelData.setData(POSITION, pos);
return modelData;
}

View file

@ -66,9 +66,7 @@ import net.minecraftforge.fml.network.PacketDistributor;
public class BuilderGunItem extends Item {
public static enum ComponentTier {
None(TextFormatting.DARK_GRAY),
BlazeBrass(TextFormatting.GOLD),
ChorusChrome(TextFormatting.LIGHT_PURPLE),
None(TextFormatting.DARK_GRAY), BlazeBrass(TextFormatting.GOLD), ChorusChrome(TextFormatting.LIGHT_PURPLE),
;
@ -108,9 +106,9 @@ public class BuilderGunItem extends Item {
for (Components c : Components.values()) {
ComponentTier tier = getTier(c, stack);
ItemDescription.add(tooltip,
"> " + TextFormatting.GRAY + Lang.translate("blockzapper.component." + c.name().toLowerCase())
"> " + TextFormatting.GRAY + Lang.translate("blockzapper.component." + Lang.asId(c.name()))
+ ": " + tier.color
+ Lang.translate("blockzapper.componentTier." + tier.name().toLowerCase()));
+ Lang.translate("blockzapper.componentTier." + Lang.asId(tier.name())));
}
}
}

View file

@ -10,9 +10,11 @@ import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.ShapedRecipe;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry;
@ -33,7 +35,12 @@ public class BuilderGunUpgradeRecipe implements ICraftingRecipe {
public boolean matches(CraftingInventory inv, World worldIn) {
return getRecipe().matches(inv, worldIn);
}
@Override
public NonNullList<Ingredient> getIngredients() {
return recipe.getIngredients();
}
@Override
public ItemStack getCraftingResult(CraftingInventory inv) {
for (int slot = 0; slot < inv.getSizeInventory(); slot++) {

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.curiosities.placementHandgun;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.utility.Lang;
public enum PlacementPatterns {
@ -15,7 +16,7 @@ public enum PlacementPatterns {
public ScreenResources icon;
private PlacementPatterns(ScreenResources icon) {
this.translationKey = name().toLowerCase();
this.translationKey = Lang.asId(name());
this.icon = icon;
}

View file

@ -60,7 +60,7 @@ public class SymmetryWandItem extends Item {
if (player.isSneaking()) {
if (player.world.isRemote) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
openWandGUI(wand);
openWandGUI(wand, context.getHand());
});
player.getCooldownTracker().setCooldown(this, 5);
}
@ -123,7 +123,7 @@ public class SymmetryWandItem extends Item {
if (playerIn.isSneaking()) {
if (worldIn.isRemote) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
openWandGUI(playerIn.getHeldItem(handIn));
openWandGUI(playerIn.getHeldItem(handIn), handIn);
});
playerIn.getCooldownTracker().setCooldown(this, 5);
}
@ -136,8 +136,8 @@ public class SymmetryWandItem extends Item {
}
@OnlyIn(Dist.CLIENT)
private void openWandGUI(ItemStack wand) {
ScreenOpener.open(new SymmetryWandScreen(wand));
private void openWandGUI(ItemStack wand, Hand hand) {
ScreenOpener.open(new SymmetryWandScreen(wand, hand));
}
private static void checkNBT(ItemStack wand) {

View file

@ -43,14 +43,16 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
private SymmetryMirror currentElement;
private float animationProgress;
private ItemStack wand;
private Hand hand;
public SymmetryWandScreen(ItemStack wand) {
public SymmetryWandScreen(ItemStack wand, Hand hand) {
super();
currentElement = SymmetryWandItem.getMirror(wand);
if (currentElement instanceof EmptyMirror) {
currentElement = new PlaneMirror(Vec3d.ZERO);
}
this.hand = hand;
this.wand = wand;
animationProgress = 0;
}
@ -170,12 +172,12 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
@Override
public void removed() {
ItemStack heldItemMainhand = minecraft.player.getHeldItemMainhand();
CompoundNBT compound = heldItemMainhand.getTag();
ItemStack heldItem = minecraft.player.getHeldItem(hand);
CompoundNBT compound = heldItem.getTag();
compound.put(SymmetryWandItem.SYMMETRY, currentElement.writeToNbt());
heldItemMainhand.setTag(compound);
AllPackets.channel.send(PacketDistributor.SERVER.noArg(), new NbtPacket(heldItemMainhand));
minecraft.player.setHeldItem(Hand.MAIN_HAND, heldItemMainhand);
heldItem.setTag(compound);
AllPackets.channel.send(PacketDistributor.SERVER.noArg(), new NbtPacket(heldItem, hand));
minecraft.player.setHeldItem(hand, heldItem);
super.removed();
}

View file

@ -30,8 +30,8 @@ import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;

View file

@ -14,8 +14,8 @@ import net.minecraft.item.BlockItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;

View file

@ -33,7 +33,9 @@ public class ConfigureFlexpeaterPacket extends TileEntityConfigurationPacket<Fle
protected void applySettings(FlexpeaterTileEntity te) {
te.maxState = maxState;
te.state = MathHelper.clamp(te.state, 0, maxState);
te.forceClientState = true;
te.sendData();
te.forceClientState = false;
}
}

View file

@ -18,6 +18,7 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT
public int newMaxState;
public int lastModified;
public boolean charging;
public boolean forceClientState;
public FlexpeaterTileEntity() {
super(AllTileEntities.FLEXPEATER.type);
@ -38,6 +39,15 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT
charging = compound.getBoolean("Charging");
maxState = compound.getInt("MaxState");
state = MathHelper.clamp(state, 0, maxState - 1);
if (compound.contains("Force"))
newMaxState = maxState;
}
@Override
public CompoundNBT writeToClient(CompoundNBT tag) {
if (forceClientState)
tag.putBoolean("Force", true);
return super.writeToClient(tag);
}
@Override

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import net.minecraft.item.Item;
@ -26,24 +27,24 @@ public class MaterialChecklist {
required = new HashMap<>();
gathered = new HashMap<>();
}
public void warnBlockNotLoaded() {
blocksNotLoaded = true;
}
public void require(Item item) {
if (required.containsKey(item))
required.put(item, required.get(item) + 1);
else
else
required.put(item, 1);
}
public void collect(ItemStack stack) {
Item item = stack.getItem();
if (required.containsKey(item))
if (gathered.containsKey(item))
gathered.put(item, gathered.get(item) + stack.getCount());
else
else
gathered.put(item, stack.getCount());
}
@ -55,44 +56,47 @@ public class MaterialChecklist {
int itemsWritten = 0;
StringBuilder string = new StringBuilder("{\"text\":\"");
if (blocksNotLoaded) {
string.append("\n" + TextFormatting.RED + "* Disclaimer *\n\n");
string.append("Material List may be inaccurate due to relevant chunks not being loaded.");
string.append("\n" + TextFormatting.RED + "* Disclaimer *\n\n");
string.append("Material List may be inaccurate due to relevant chunks not being loaded.");
string.append("\"}");
pages.add(new StringNBT(string.toString()));
string = new StringBuilder("{\"text\":\"");
}
List<Item> keys = new ArrayList<>(required.keySet());
Collections.sort(keys, (item1, item2) -> {
String name1 = new TranslationTextComponent(((Item) item1).getTranslationKey()).getFormattedText().toLowerCase();
String name2 = new TranslationTextComponent(((Item) item2).getTranslationKey()).getFormattedText().toLowerCase();
Locale locale = Locale.ENGLISH;
String name1 = new TranslationTextComponent(((Item) item1).getTranslationKey()).getFormattedText()
.toLowerCase(locale);
String name2 = new TranslationTextComponent(((Item) item2).getTranslationKey()).getFormattedText()
.toLowerCase(locale);
return name1.compareTo(name2);
});
List<Item> completed = new ArrayList<>();
for (Item item : keys) {
int amount = required.get(item);
if (gathered.containsKey(item))
amount -= gathered.get(item);
if (amount <= 0) {
completed.add(item);
continue;
}
if (itemsWritten == 6) {
itemsWritten = 0;
string.append("\"}");
pages.add(new StringNBT(string.toString()));
string = new StringBuilder("{\"text\":\"");
}
itemsWritten++;
string.append(unfinishedEntry(new ItemStack(item), amount));
}
for (Item item : completed) {
if (itemsWritten == 6) {
itemsWritten = 0;
@ -100,11 +104,11 @@ public class MaterialChecklist {
pages.add(new StringNBT(string.toString()));
string = new StringBuilder("{\"text\":\"");
}
itemsWritten++;
string.append(gatheredEntry(new ItemStack(item), required.get(item)));
}
string.append("\"}");
pages.add(new StringNBT(string.toString()));
@ -120,16 +124,16 @@ public class MaterialChecklist {
int stacks = amount / 64;
int remainder = amount % 64;
ITextComponent tc = new TranslationTextComponent(item.getTranslationKey());
return TextFormatting.DARK_GREEN + tc.getFormattedText()
+ " \\u2714\n x" + amount + TextFormatting.GRAY + " | " + stacks + "\\u25A4 +" + remainder + "\n";
return TextFormatting.DARK_GREEN + tc.getFormattedText() + " \\u2714\n x" + amount + TextFormatting.GRAY + " | "
+ stacks + "\\u25A4 +" + remainder + "\n";
}
private String unfinishedEntry(ItemStack item, int amount) {
int stacks = amount / 64;
int remainder = amount % 64;
ITextComponent tc = new TranslationTextComponent(item.getTranslationKey());
return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount
+ TextFormatting.GRAY + " | " + stacks + "\\u25A4 +" + remainder + "\n";
return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount + TextFormatting.GRAY + " | " + stacks
+ "\\u25A4 +" + remainder + "\n";
}
}

View file

@ -3,12 +3,11 @@ package com.simibubi.create.modules.schematics;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.function.Predicate;
import com.google.common.collect.ImmutableMap;
import com.simibubi.create.foundation.type.Cuboid;
import com.simibubi.create.foundation.utility.WrappedWorld;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -16,47 +15,34 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.particles.IParticleData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.EmptyTickList;
import net.minecraft.world.ITickList;
import net.minecraft.world.IWorld;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.border.WorldBorder;
import net.minecraft.world.chunk.AbstractChunkProvider;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.gen.Heightmap.Type;
import net.minecraft.world.storage.WorldInfo;
public class SchematicWorld implements IWorld {
public class SchematicWorld extends WrappedWorld {
private Map<BlockPos, BlockState> blocks;
private Cuboid bounds;
public BlockPos anchor;
public SchematicWorld(Map<BlockPos, BlockState> blocks, Cuboid bounds, BlockPos anchor) {
public SchematicWorld(Map<BlockPos, BlockState> blocks, Cuboid bounds, BlockPos anchor, World original) {
super(original);
this.blocks = blocks;
this.setBounds(bounds);
this.anchor = anchor;
}
public Set<BlockPos> getAllPositions() {
return blocks.keySet();
}
@Override
public TileEntity getTileEntity(BlockPos pos) {
return null;
@ -65,11 +51,11 @@ public class SchematicWorld implements IWorld {
@Override
public BlockState getBlockState(BlockPos globalPos) {
BlockPos pos = globalPos.subtract(anchor);
if (pos.getY() - bounds.y == -1) {
return Blocks.GRASS_BLOCK.getDefaultState();
}
if (getBounds().contains(pos) && blocks.containsKey(pos)) {
return blocks.get(pos);
} else {
@ -83,7 +69,7 @@ public class SchematicWorld implements IWorld {
@Override
public IFluidState getFluidState(BlockPos pos) {
return new FluidState(Fluids.EMPTY, ImmutableMap.of());
return getBlockState(pos).getFluidState();
}
@Override
@ -117,46 +103,11 @@ public class SchematicWorld implements IWorld {
return 0;
}
@Override
public IChunk getChunk(int x, int z, ChunkStatus requiredStatus, boolean nonnull) {
return null;
}
@Override
public BlockPos getHeight(Type heightmapType, BlockPos pos) {
return BlockPos.ZERO;
}
@Override
public int getHeight(Type heightmapType, int x, int z) {
return 0;
}
@Override
public int getSkylightSubtracted() {
return 0;
}
@Override
public WorldBorder getWorldBorder() {
return null;
}
@Override
public boolean isRemote() {
return false;
}
@Override
public int getSeaLevel() {
return 0;
}
@Override
public Dimension getDimension() {
return null;
}
@Override
public boolean hasBlockState(BlockPos pos, Predicate<BlockState> predicate) {
return predicate.test(getBlockState(pos));
@ -197,16 +148,11 @@ public class SchematicWorld implements IWorld {
if (boundsMax.getZ() <= pos.getZ()) {
bounds.length += pos.getZ() - boundsMax.getZ() + 1;
}
blocks.put(pos, arg1);
return true;
}
@Override
public long getSeed() {
return 0;
}
@Override
public ITickList<Block> getPendingBlockTicks() {
return EmptyTickList.get();
@ -217,54 +163,6 @@ public class SchematicWorld implements IWorld {
return EmptyTickList.get();
}
@Override
public World getWorld() {
return null;
}
@Override
public WorldInfo getWorldInfo() {
return null;
}
@Override
public DifficultyInstance getDifficultyForLocation(BlockPos pos) {
return null;
}
@Override
public AbstractChunkProvider getChunkProvider() {
return null;
}
@Override
public Random getRandom() {
return new Random();
}
@Override
public void notifyNeighbors(BlockPos pos, Block blockIn) {
}
@Override
public BlockPos getSpawnPoint() {
return null;
}
@Override
public void playSound(PlayerEntity player, BlockPos pos, SoundEvent soundIn, SoundCategory category, float volume,
float pitch) {
}
@Override
public void addParticle(IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed,
double zSpeed) {
}
@Override
public void playEvent(PlayerEntity player, int type, BlockPos pos, int data) {
}
public Cuboid getBounds() {
return bounds;
}

View file

@ -535,7 +535,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
}
schematicAnchor = anchor;
blockReader = new SchematicWorld(new HashMap<>(), new Cuboid(), schematicAnchor);
blockReader = new SchematicWorld(new HashMap<>(), new Cuboid(), schematicAnchor, world);
activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, SchematicItem.getSettings(blueprint));
schematicLoaded = true;
state = State.PAUSED;

View file

@ -209,7 +209,7 @@ public class SchematicHandler {
if (schematic.getSize().equals(BlockPos.ZERO))
return;
SchematicWorld w = new SchematicWorld(new HashMap<>(), new Cuboid(), anchor);
SchematicWorld w = new SchematicWorld(new HashMap<>(), new Cuboid(), anchor, Minecraft.getInstance().world);
PlacementSettings settings = cachedSettings.copy();
settings.setBoundingBox(null);
schematic.addBlocksToWorld(w, anchor, settings);

View file

@ -49,7 +49,8 @@ public class SchematicHologram {
}
public void startHologram(Template schematic, BlockPos anchor) {
SchematicWorld world = new SchematicWorld(new HashMap<>(), new Cuboid(BlockPos.ZERO, BlockPos.ZERO), anchor);
SchematicWorld world = new SchematicWorld(new HashMap<>(), new Cuboid(BlockPos.ZERO, BlockPos.ZERO), anchor,
Minecraft.getInstance().world);
schematic.addBlocksToWorld(world, anchor, new PlacementSettings());
startHologram(world);
}

View file

@ -29,7 +29,7 @@ public enum Tools {
}
public String getDisplayName() {
return Lang.translate("schematic.tool." + name().toLowerCase());
return Lang.translate("schematic.tool." + Lang.asId(name()));
}
public ScreenResources getIcon() {
@ -45,7 +45,7 @@ public enum Tools {
}
public List<String> getDescription() {
return Lang.translatedOptions("schematic.tool." + name().toLowerCase() + ".description", "0", "1", "2", "3");
return Lang.translatedOptions("schematic.tool." + Lang.asId(name()) + ".description", "0", "1", "2", "3");
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -10,7 +10,7 @@
"item": "minecraft:iron_bars"
},
"A": {
"item": "create:iron_sheet"
"item": "create:andesite_alloy_cube"
},
"S": {
"item": "create:propeller"

View file

@ -0,0 +1,21 @@
{
"type": "crafting_shapeless",
"ingredients": [
{
"tag": "forge:dyes/lime"
},
{
"item": "create:dough"
}
],
"result": {
"item": "minecraft:slime_ball",
"count": 1
},
"conditions": [
{
"type": "create:module",
"module": "contraptions"
}
]
}

View file

@ -1,9 +1,23 @@
{
"type": "crafting_shapeless",
"ingredients": [
{
"item": "minecraft:horn_coral"
},
[
{
"item": "minecraft:horn_coral"
},
{
"item": "minecraft:tube_coral"
},
{
"item": "minecraft:fire_coral"
},
{
"item": "minecraft:bubble_coral"
},
{
"item": "minecraft:brain_coral"
}
],
{
"item": "minecraft:bone_meal"
},