From b46a5fbcf9d23c7893eb7a211bfbd99ed173e98d Mon Sep 17 00:00:00 2001 From: MrTroble Date: Thu, 5 Aug 2021 22:51:05 +0200 Subject: [PATCH] Inital 1.13.2 release --- build.gradle | 14 +---- changelog.md | 2 + .../eu/gir/gircredstone/GIRCRedstoneMain.java | 23 ++------ .../eu/gir/gircredstone/block/BlockBasic.java | 5 +- .../block/BlockRedstoneAcceptor.java | 46 ++++++--------- .../block/BlockRedstoneEmitter.java | 23 +++++--- .../eu/gir/gircredstone/init/GIRCInit.java | 28 +++++++-- .../eu/gir/gircredstone/item/Linkingtool.java | 59 ++++++++++--------- .../gir/gircredstone/proxy/ClientProxy.java | 31 ---------- .../gir/gircredstone/proxy/CommonProxy.java | 15 ----- .../tile/TileRedstoneEmitter.java | 44 ++++++++------ .../gircredstone/blockstates/acceptor.json | 4 +- .../gircredstone/blockstates/emitter.json | 4 +- src/main/resources/mcmod.info | 16 ----- 14 files changed, 127 insertions(+), 187 deletions(-) delete mode 100644 src/main/java/eu/gir/gircredstone/proxy/ClientProxy.java delete mode 100644 src/main/java/eu/gir/gircredstone/proxy/CommonProxy.java delete mode 100644 src/main/resources/mcmod.info diff --git a/build.gradle b/build.gradle index c7ea40c..512bff5 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ archivesBaseName = 'GIRC-Redstone' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' minecraft { - mappings channel: 'snapshot', version: '20171003-1.12' + mappings channel: 'snapshot', version: '20180921-1.13' runs { client { @@ -56,7 +56,7 @@ minecraft { } dependencies { - minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2854' + minecraft 'net.minecraftforge:forge:1.13.2-25.0.219' } jar { @@ -73,16 +73,6 @@ jar { } } -processResources { - from(sourceSets.main.resources.srcDirs) { - include "mcmod.info" - expand "version":System.getenv("APPVEYOR_BUILD_VERSION") - } - from(sourceSets.main.resources.srcDirs) { - exclude "mcmod.info" - } -} - jar.finalizedBy('reobfJar') publishing { publications { diff --git a/changelog.md b/changelog.md index b8da64e..5cb3dc7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # Changelog +## 1.13.2 release + ## [Fix] 07.28.2021 - 1 * Fixed issues with server sided translation keys diff --git a/src/main/java/eu/gir/gircredstone/GIRCRedstoneMain.java b/src/main/java/eu/gir/gircredstone/GIRCRedstoneMain.java index f59a266..c054078 100644 --- a/src/main/java/eu/gir/gircredstone/GIRCRedstoneMain.java +++ b/src/main/java/eu/gir/gircredstone/GIRCRedstoneMain.java @@ -1,28 +1,15 @@ package eu.gir.gircredstone; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import eu.gir.gircredstone.proxy.CommonProxy; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -@Mod(modid = GIRCRedstoneMain.MODID) -public class GIRCRedstoneMain -{ - public static final String MODID = "gircredstone"; +@Mod(GIRCRedstoneMain.MODID) +public class GIRCRedstoneMain { - public static Logger logger; + public static final Logger LOGGER = LogManager.getLogger(); - @SidedProxy(serverSide = "eu.gir.gircredstone.proxy.CommonProxy", clientSide = "eu.gir.gircredstone.proxy.ClientProxy") - public static CommonProxy PROXY; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - logger = event.getModLog(); - PROXY.preinit(); - } + public static final String MODID = "gircredstone"; } diff --git a/src/main/java/eu/gir/gircredstone/block/BlockBasic.java b/src/main/java/eu/gir/gircredstone/block/BlockBasic.java index 6cdf4ad..a07ec29 100644 --- a/src/main/java/eu/gir/gircredstone/block/BlockBasic.java +++ b/src/main/java/eu/gir/gircredstone/block/BlockBasic.java @@ -3,15 +3,12 @@ import eu.gir.gircredstone.GIRCRedstoneMain; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; public class BlockBasic extends Block { public BlockBasic(final String name) { - super(Material.CIRCUITS); + super(Properties.create(Material.CIRCUITS)); this.setRegistryName(GIRCRedstoneMain.MODID, name); - this.setCreativeTab(CreativeTabs.REDSTONE); - this.setUnlocalizedName(name); } } diff --git a/src/main/java/eu/gir/gircredstone/block/BlockRedstoneAcceptor.java b/src/main/java/eu/gir/gircredstone/block/BlockRedstoneAcceptor.java index d5335e7..43ae703 100644 --- a/src/main/java/eu/gir/gircredstone/block/BlockRedstoneAcceptor.java +++ b/src/main/java/eu/gir/gircredstone/block/BlockRedstoneAcceptor.java @@ -1,50 +1,40 @@ package eu.gir.gircredstone.block; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer.Builder; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; public class BlockRedstoneAcceptor extends BlockBasic { - public static final PropertyBool POWER = PropertyBool.create("power"); + public static final BooleanProperty POWER = BooleanProperty.create("power"); public BlockRedstoneAcceptor() { super("acceptor"); - this.setDefaultState(getDefaultState().withProperty(POWER, false)); + this.setDefaultState(getDefaultState().with(POWER, false)); } - + @Override - public int getMetaFromState(IBlockState state) { - return state.getValue(POWER) ? 0:1; + public boolean canProvidePower(IBlockState state) { + return true; } @Override - public boolean canProvidePower(IBlockState state) { - return true; + public int getWeakPower(IBlockState blockState, IBlockReader blockAccess, BlockPos pos, EnumFacing side) { + return this.getStrongPower(blockState, blockAccess, pos, side); } - public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) - { - return getStrongPower(blockState, blockAccess, pos, side); + @Override + public int getStrongPower(IBlockState blockState, IBlockReader blockAccess, BlockPos pos, EnumFacing side) { + return blockState.get(POWER) ? 15:0; } - public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) - { - return blockState.getValue(POWER) ? 15:0; + @Override + protected void fillStateContainer(Builder builder) { + builder.add(POWER); } - - @Override - public IBlockState getStateFromMeta(int meta) { - return this.getDefaultState().withProperty(POWER, meta == 1); - } - - @Override - protected BlockStateContainer createBlockState() { - return new BlockStateContainer(this, new IProperty[] { POWER }); - } - + } diff --git a/src/main/java/eu/gir/gircredstone/block/BlockRedstoneEmitter.java b/src/main/java/eu/gir/gircredstone/block/BlockRedstoneEmitter.java index 4d882d5..f6c312b 100644 --- a/src/main/java/eu/gir/gircredstone/block/BlockRedstoneEmitter.java +++ b/src/main/java/eu/gir/gircredstone/block/BlockRedstoneEmitter.java @@ -11,8 +11,10 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +@SuppressWarnings("deprecation") public class BlockRedstoneEmitter extends BlockBasic implements ITileEntityProvider { public BlockRedstoneEmitter() { @@ -20,16 +22,16 @@ public BlockRedstoneEmitter() { } @Override - public TileEntity createNewTileEntity(World worldIn, int meta) { - return new TileRedstoneEmitter(); + public TileEntity createTileEntity(IBlockState state, IBlockReader world) { + return createNewTileEntity(world); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, - EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, + EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) return true; - if(player.getHeldItem(hand).getItem().equals(GIRCInit.RS_LINKER)) + if (player.getHeldItem(hand).getItem().equals(GIRCInit.RS_LINKER)) return false; final TileEntity entity = world.getTileEntity(pos); if (entity instanceof TileRedstoneEmitter) { @@ -40,9 +42,11 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } else { if (player.isSneaking()) { emitter.unlink(); - player.sendMessage(new TextComponentTranslation("em.unlink", linkedpos.getX(), linkedpos.getY(), linkedpos.getZ())); + player.sendMessage(new TextComponentTranslation("em.unlink", linkedpos.getX(), linkedpos.getY(), + linkedpos.getZ())); } else { - player.sendMessage(new TextComponentTranslation("lt.linkedpos", linkedpos.getX(), linkedpos.getY(), linkedpos.getZ())); + player.sendMessage(new TextComponentTranslation("lt.linkedpos", linkedpos.getX(), linkedpos.getY(), + linkedpos.getZ())); } } return true; @@ -60,4 +64,9 @@ public void neighborChanged(IBlockState state, World world, BlockPos pos, Block emitter.redstoneUpdate(world.isBlockPowered(pos)); } } + + @Override + public TileEntity createNewTileEntity(IBlockReader worldIn) { + return new TileRedstoneEmitter(); + } } diff --git a/src/main/java/eu/gir/gircredstone/init/GIRCInit.java b/src/main/java/eu/gir/gircredstone/init/GIRCInit.java index 9448e44..77ddf9f 100644 --- a/src/main/java/eu/gir/gircredstone/init/GIRCInit.java +++ b/src/main/java/eu/gir/gircredstone/init/GIRCInit.java @@ -1,36 +1,54 @@ package eu.gir.gircredstone.init; +import eu.gir.gircredstone.GIRCRedstoneMain; import eu.gir.gircredstone.block.BlockRedstoneAcceptor; import eu.gir.gircredstone.block.BlockRedstoneEmitter; import eu.gir.gircredstone.item.Linkingtool; +import eu.gir.gircredstone.tile.TileRedstoneEmitter; import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.minecraft.item.Item.Properties; import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemGroup; +import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.registries.IForgeRegistry; +@Mod.EventBusSubscriber(bus=Bus.MOD, modid = GIRCRedstoneMain.MODID) public class GIRCInit { public static final Block RS_ACCEPTOR = new BlockRedstoneAcceptor(); public static final Block RS_EMITTER = new BlockRedstoneEmitter(); public static final Item RS_LINKER = new Linkingtool(); - + @SubscribeEvent public static void registerBlock(RegistryEvent.Register event) { IForgeRegistry registry = event.getRegistry(); registry.register(RS_ACCEPTOR); registry.register(RS_EMITTER); + GIRCRedstoneMain.LOGGER.info("Hello!000000000000=========================================000000"); } @SubscribeEvent public static void registerItem(RegistryEvent.Register event) { IForgeRegistry registry = event.getRegistry(); - registry.register(new ItemBlock(RS_ACCEPTOR).setRegistryName(RS_ACCEPTOR.getRegistryName())); + registry.register(new ItemBlock(RS_ACCEPTOR, new Properties().group(ItemGroup.REDSTONE)) + .setRegistryName(RS_ACCEPTOR.getRegistryName())); registry.register(RS_LINKER); - registry.register(new ItemBlock(RS_EMITTER).setRegistryName(RS_EMITTER.getRegistryName())); + registry.register(new ItemBlock(RS_EMITTER, new Properties().group(ItemGroup.REDSTONE)) + .setRegistryName(RS_EMITTER.getRegistryName())); + } + + public static final TileEntityType EMITER_TILE = TileEntityType.Builder.create(TileRedstoneEmitter::new).build(null); + + @SubscribeEvent + public static void registerTE(RegistryEvent.Register> evt) { + EMITER_TILE.setRegistryName(GIRCRedstoneMain.MODID, "emitter"); + evt.getRegistry().register(EMITER_TILE); } - } diff --git a/src/main/java/eu/gir/gircredstone/item/Linkingtool.java b/src/main/java/eu/gir/gircredstone/item/Linkingtool.java index eb893b4..e921729 100644 --- a/src/main/java/eu/gir/gircredstone/item/Linkingtool.java +++ b/src/main/java/eu/gir/gircredstone/item/Linkingtool.java @@ -2,33 +2,33 @@ import java.util.List; -import com.google.common.collect.Lists; +import javax.annotation.Nullable; import eu.gir.gircredstone.GIRCRedstoneMain; import eu.gir.gircredstone.block.BlockRedstoneAcceptor; import eu.gir.gircredstone.block.BlockRedstoneEmitter; import eu.gir.gircredstone.tile.TileRedstoneEmitter; import net.minecraft.block.Block; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class Linkingtool extends Item { public Linkingtool() { - this.setCreativeTab(CreativeTabs.REDSTONE); + super(new Properties().group(ItemGroup.REDSTONE)); this.setRegistryName(GIRCRedstoneMain.MODID, "linker"); - this.setUnlocalizedName(this.getRegistryName().getResourcePath()); } private static final String ID_X = "xLinkedPos"; @@ -37,52 +37,53 @@ public Linkingtool() { public static void writeBlockPosToNBT(BlockPos pos, NBTTagCompound compound) { if (pos != null && compound != null) { - compound.setInteger(ID_X, pos.getX()); - compound.setInteger(ID_Y, pos.getY()); - compound.setInteger(ID_Z, pos.getZ()); + compound.setInt(ID_X, pos.getX()); + compound.setInt(ID_Y, pos.getY()); + compound.setInt(ID_Z, pos.getZ()); } } public static BlockPos readBlockPosFromNBT(NBTTagCompound compound) { if (compound != null && compound.hasKey(ID_X) && compound.hasKey(ID_Y) && compound.hasKey(ID_Z)) { - return new BlockPos(compound.getInteger(ID_X), compound.getInteger(ID_Y), compound.getInteger(ID_Z)); + return new BlockPos(compound.getInt(ID_X), compound.getInt(ID_Y), compound.getInt(ID_Z)); } return null; } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, - EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(ItemUseContext ctx) { + final World worldIn = ctx.getWorld(); + final EntityPlayer player = ctx.getPlayer(); + final BlockPos pos = ctx.getPos(); if (worldIn.isRemote) return EnumActionResult.PASS; final Block block = worldIn.getBlockState(pos).getBlock(); + final ItemStack stack = ctx.getItem(); if (player.isSneaking()) { - final ItemStack stack = player.getHeldItem(hand); - if (Linkingtool.readBlockPosFromNBT(stack.getTagCompound()) != null) { - stack.setTagCompound(null); + if (Linkingtool.readBlockPosFromNBT(stack.getTag()) != null) { + stack.setTag(null); player.sendMessage(new TextComponentTranslation("lt.reset")); return EnumActionResult.SUCCESS; } } if (block instanceof BlockRedstoneAcceptor) { final NBTTagCompound comp = new NBTTagCompound(); - final ItemStack stack = player.getHeldItem(hand); - if (readBlockPosFromNBT(stack.getTagCompound()) != null) + if (readBlockPosFromNBT(stack.getTag()) != null) return EnumActionResult.FAIL; writeBlockPosToNBT(pos, comp); - player.getHeldItem(hand).setTagCompound(comp); + stack.setTag(comp); player.sendMessage(new TextComponentTranslation("lt.setpos", pos.getX(), pos.getY(), pos.getZ())); player.sendMessage(new TextComponentTranslation("lt.setpos.msg")); return EnumActionResult.SUCCESS; } if (block instanceof BlockRedstoneEmitter) { final TileRedstoneEmitter emitter = (TileRedstoneEmitter) worldIn.getTileEntity(pos); - final ItemStack stack = player.getHeldItem(hand); - final NBTTagCompound comp = stack.getTagCompound(); + final NBTTagCompound comp = stack.getTag(); final BlockPos linkpos = Linkingtool.readBlockPosFromNBT(comp); if (emitter.link(linkpos)) { - player.sendMessage(new TextComponentTranslation("lt.linkedpos", linkpos.getX(), linkpos.getY(), linkpos.getZ())); - stack.setTagCompound(null); + player.sendMessage( + new TextComponentTranslation("lt.linkedpos", linkpos.getX(), linkpos.getY(), linkpos.getZ())); + stack.setTag(null); player.sendMessage(new TextComponentTranslation("lt.reset")); return EnumActionResult.SUCCESS; } @@ -92,19 +93,19 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p } return EnumActionResult.FAIL; } - + + @OnlyIn(Dist.CLIENT) @Override - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { - final NBTTagCompound nbt = stack.getTagCompound(); + public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + final NBTTagCompound nbt = stack.getTag(); if (nbt != null) { final BlockPos pos = Linkingtool.readBlockPosFromNBT(nbt); if (pos != null) { - tooltip.add(I18n.format("lt.linkedpos", pos.getX(), pos.getY(), pos.getZ())); + tooltip.add(new TextComponentTranslation("lt.linkedpos", pos.getX(), pos.getY(), pos.getZ())); return; } } - tooltip.addAll(Lists.newArrayList( - I18n.format("lt.notlinked").replaceAll(String.valueOf((char) 13), "").trim().split("\n"))); + tooltip.add(new TextComponentTranslation("lt.notlinked")); } } diff --git a/src/main/java/eu/gir/gircredstone/proxy/ClientProxy.java b/src/main/java/eu/gir/gircredstone/proxy/ClientProxy.java deleted file mode 100644 index 52ff390..0000000 --- a/src/main/java/eu/gir/gircredstone/proxy/ClientProxy.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.gir.gircredstone.proxy; - -import eu.gir.gircredstone.init.GIRCInit; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class ClientProxy extends CommonProxy { - - @Override - public void preinit() { - super.preinit(); - MinecraftForge.EVENT_BUS.register(ClientProxy.class); - } - - @SubscribeEvent - public static void register(ModelRegistryEvent event) { - registerM(GIRCInit.RS_LINKER); - registerM(Item.getItemFromBlock(GIRCInit.RS_ACCEPTOR)); - registerM(Item.getItemFromBlock(GIRCInit.RS_EMITTER)); - } - - private static void registerM(final Item item) { - ModelLoader.setCustomModelResourceLocation(item, 0, - new ModelResourceLocation(item.getRegistryName(), "inventory")); - } - -} diff --git a/src/main/java/eu/gir/gircredstone/proxy/CommonProxy.java b/src/main/java/eu/gir/gircredstone/proxy/CommonProxy.java deleted file mode 100644 index b465746..0000000 --- a/src/main/java/eu/gir/gircredstone/proxy/CommonProxy.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.gir.gircredstone.proxy; - -import eu.gir.gircredstone.init.GIRCInit; -import eu.gir.gircredstone.tile.TileRedstoneEmitter; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.MinecraftForge; - -public class CommonProxy { - - public void preinit() { - MinecraftForge.EVENT_BUS.register(GIRCInit.class); - TileEntity.register("rsemitter", TileRedstoneEmitter.class); - } - -} diff --git a/src/main/java/eu/gir/gircredstone/tile/TileRedstoneEmitter.java b/src/main/java/eu/gir/gircredstone/tile/TileRedstoneEmitter.java index 3f73917..751b4dd 100644 --- a/src/main/java/eu/gir/gircredstone/tile/TileRedstoneEmitter.java +++ b/src/main/java/eu/gir/gircredstone/tile/TileRedstoneEmitter.java @@ -1,6 +1,9 @@ package eu.gir.gircredstone.tile; +import com.google.common.collect.Lists; + import eu.gir.gircredstone.block.BlockRedstoneAcceptor; +import eu.gir.gircredstone.init.GIRCInit; import eu.gir.gircredstone.item.Linkingtool; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; @@ -11,17 +14,21 @@ public class TileRedstoneEmitter extends TileEntity { - private BlockPos linkedpos = null; + public TileRedstoneEmitter() { + super(GIRCInit.EMITER_TILE); + } + private BlockPos linkedpos = null; + @Override - public NBTTagCompound writeToNBT(NBTTagCompound compound) { + public NBTTagCompound write(NBTTagCompound compound) { Linkingtool.writeBlockPosToNBT(linkedpos, compound); - return super.writeToNBT(compound); + return super.write(compound); } @Override - public void readFromNBT(NBTTagCompound compound) { - super.readFromNBT(compound); + public void read(NBTTagCompound compound) { + super.read(compound); this.linkedpos = Linkingtool.readBlockPosFromNBT(compound); } @@ -42,26 +49,27 @@ public boolean unlink() { public BlockPos getLinkedPos() { return this.linkedpos; } + + public void accept(final boolean enabled) { + final IBlockState state = world.getBlockState(linkedpos); + if (state.getBlock() instanceof BlockRedstoneAcceptor) { + world.setBlockState(linkedpos, state.with(BlockRedstoneAcceptor.POWER, enabled)); + } + } public void redstoneUpdate(final boolean enabled) { if (linkedpos != null) { final boolean flag = !world.isBlockLoaded(linkedpos); - Chunk lchunk = null; if(flag) { - final Chunk chunk = world.getChunkFromBlockCoords(linkedpos); - final ChunkProviderServer provider = (ChunkProviderServer) world.getChunkProvider(); - lchunk = provider.loadChunk(chunk.x, chunk.z); - if(lchunk == null) - return; - } - final IBlockState state = world.getBlockState(linkedpos); - if (state.getBlock() instanceof BlockRedstoneAcceptor) { - world.setBlockState(linkedpos, state.withProperty(BlockRedstoneAcceptor.POWER, enabled)); - } - if(lchunk != null) { + final Chunk chunk = world.getChunk(linkedpos); final ChunkProviderServer provider = (ChunkProviderServer) world.getChunkProvider(); - provider.queueUnload(lchunk); + provider.loadChunks(Lists.newArrayList(chunk.getPos()), ch -> { + accept(enabled); + provider.queueUnload(ch); + }); + return; } + accept(enabled); } } diff --git a/src/main/resources/assets/gircredstone/blockstates/acceptor.json b/src/main/resources/assets/gircredstone/blockstates/acceptor.json index 832599b..2eb47fd 100644 --- a/src/main/resources/assets/gircredstone/blockstates/acceptor.json +++ b/src/main/resources/assets/gircredstone/blockstates/acceptor.json @@ -1,10 +1,10 @@ { "variants": { "power=false": { - "model": "gircredstone:acceptor_off" + "model": "gircredstone:block/acceptor_off" }, "power=true": { - "model": "gircredstone:acceptor_on" + "model": "gircredstone:block/acceptor_on" } } } \ No newline at end of file diff --git a/src/main/resources/assets/gircredstone/blockstates/emitter.json b/src/main/resources/assets/gircredstone/blockstates/emitter.json index 68156aa..5e82308 100644 --- a/src/main/resources/assets/gircredstone/blockstates/emitter.json +++ b/src/main/resources/assets/gircredstone/blockstates/emitter.json @@ -1,7 +1,7 @@ { "variants": { - "normal": { - "model": "gircredstone:emitter" + "": { + "model": "gircredstone:block/emitter" } } } \ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info deleted file mode 100644 index 4a85ff2..0000000 --- a/src/main/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "gircredstone", - "name": "GIRC Redstone", - "description": "The official Wireless Redstone Mod for GIR.", - "version": "${version}", - "mcversion": "1.12.2", - "url": "https://girc.eu/", - "updateUrl": "", - "authorList": ["MrTroble", "Jeronimo"], - "credits": "MrTroble", - "logoFile": "", - "screenshots": [], - "dependencies": [] -} -]