From d4b8cc52363c01bc0674e9d50ebfdb4bab10ba5e Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Tue, 24 Oct 2017 11:11:11 +0200 Subject: [PATCH] Update to master --- .../v1_11_2/launcher/FMLEventHandler.java | 5 +- .../v1_11_2/launcher/ForgeEventHandler.java | 16 ++-- .../v1_11_2/manager/MCRetentionManager.java | 14 +-- .../manager/config/NovaGuiFactory.java | 2 + .../network/discriminator/NovaPacket.java | 5 +- .../mc/forge/v1_11_2/util/ReflectionUtil.java | 3 +- .../mc/forge/v1_11_2/util/WrapUtility.java | 7 +- .../wrapper/block/backward/BWBlock.java | 15 ++- .../block/backward/BWBlockTransform.java | 7 +- .../wrapper/block/forward/FWBlock.java | 91 +++++++++++++------ .../v1_11_2/wrapper/block/forward/FWTile.java | 5 +- .../wrapper/block/forward/ProxyMaterial.java | 8 +- .../v1_11_2/wrapper/block/world/BWWorld.java | 13 +-- .../forward/NovaCapabilityProvider.java | 11 ++- .../wrapper/entity/forward/FWEntity.java | 19 ++-- .../entity/forward/MCEntityTransform.java | 11 ++- .../wrapper/inventory/BWInventory.java | 15 +-- .../particle/forward/MCParticleTransform.java | 3 +- .../render/forward/FWSmartBlockModel.java | 17 ++-- .../render/forward/FWSmartItemModel.java | 17 ++-- 20 files changed, 165 insertions(+), 119 deletions(-) diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/FMLEventHandler.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/FMLEventHandler.java index b53428620..c1c38b432 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/FMLEventHandler.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/FMLEventHandler.java @@ -23,6 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import nova.core.event.PlayerEvent; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.EntityConverter; import nova.internal.core.Game; /** @@ -32,12 +33,12 @@ public class FMLEventHandler { @SubscribeEvent public void playerJoin(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent evt) { - Game.events().publish(new PlayerEvent.Join(Game.natives().toNova(evt.player))); + Game.events().publish(new PlayerEvent.Join(EntityConverter.instance().toNova(evt.player))); } @SubscribeEvent public void playerLeave(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent evt) { - Game.events().publish(new PlayerEvent.Leave(Game.natives().toNova(evt.player))); + Game.events().publish(new PlayerEvent.Leave(EntityConverter.instance().toNova(evt.player))); } @SubscribeEvent diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/ForgeEventHandler.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/ForgeEventHandler.java index f64e066ad..b2b758d03 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/ForgeEventHandler.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/launcher/ForgeEventHandler.java @@ -29,9 +29,11 @@ import net.minecraftforge.oredict.OreDictionary; import nova.core.item.Item; import nova.core.item.ItemDictionary; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.VectorConverter; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.world.WorldConverter; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.EntityConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.item.ItemConverter; import nova.internal.core.Game; -import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; /** * @author Stan, Calclavia @@ -40,12 +42,12 @@ public class ForgeEventHandler { @SubscribeEvent public void worldUnload(WorldEvent.Load evt) { - Game.events().publish(new nova.core.event.WorldEvent.Load(Game.natives().toNova(evt.getWorld()))); + Game.events().publish(new nova.core.event.WorldEvent.Load(WorldConverter.instance().toNova(evt.getWorld()))); } @SubscribeEvent public void worldLoad(WorldEvent.Unload evt) { - Game.events().publish(new nova.core.event.WorldEvent.Unload(Game.natives().toNova(evt.getWorld()))); + Game.events().publish(new nova.core.event.WorldEvent.Unload(WorldConverter.instance().toNova(evt.getWorld()))); } @SubscribeEvent @@ -60,11 +62,11 @@ public void onOreRegister(OreDictionary.OreRegisterEvent event) { @SubscribeEvent public void playerInteractEvent(PlayerInteractEvent event) { - if (event.getWorld() != null && event.getPos() != null) { + if (event.getWorld() != null) { nova.core.event.PlayerEvent.Interact evt = new nova.core.event.PlayerEvent.Interact( - Game.natives().toNova(event.getWorld()), - new Vector3D(event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()), - Game.natives().toNova(event.getEntityPlayer()), + WorldConverter.instance().toNova(event.getWorld()), + VectorConverter.instance().toNova(event.getPos()), + EntityConverter.instance().toNova(event.getEntityPlayer()), nova.core.event.PlayerEvent.Interact.Action.values()[toNovaInteractOrdinal(event)] ); diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/MCRetentionManager.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/MCRetentionManager.java index c952ec1e0..a3cdd0573 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/MCRetentionManager.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/MCRetentionManager.java @@ -22,20 +22,20 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.server.FMLServerHandler; import nova.core.retention.Data; import nova.core.retention.Storable; import nova.core.util.registry.RetentionManager; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.data.DataConverter; import nova.internal.core.Game; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import net.minecraftforge.fml.server.FMLServerHandler; /** * A manager that handles external file saving. @@ -60,13 +60,13 @@ public void saveAll() { public void save(String filename, Storable storable) { Data saveMap = new Data(); storable.save(saveMap); - saveFile(filename, Game.natives().toNative(saveMap)); + saveFile(filename, DataConverter.instance().toNative(saveMap)); } @Override public void load(String filename, Storable storable) { NBTTagCompound nbt = loadFile(filename); - storable.load(Game.natives().toNova(nbt)); + storable.load(DataConverter.instance().toNova(nbt)); } /** @@ -77,7 +77,7 @@ public void load(String filename, Storable storable) { */ public boolean saveFile(File file, NBTTagCompound data) { try { - File tempFile = new File(file.getParent(), file.getName() + "_tmp.dat"); + File tempFile = new File(file.getParent(), file.getName().replaceFirst("\\.nbt$", ".tmp.nbt")); CompressedStreamTools.writeCompressed(data, new FileOutputStream(tempFile)); @@ -95,7 +95,7 @@ public boolean saveFile(File file, NBTTagCompound data) { } public boolean saveFile(File saveDirectory, String filename, NBTTagCompound data) { - return saveFile(new File(saveDirectory, filename + ".dat"), data); + return saveFile(new File(saveDirectory, filename + ".nbt"), data); } public boolean saveFile(String filename, NBTTagCompound data) { @@ -123,7 +123,7 @@ public NBTTagCompound loadFile(File file) { * @return The NBT data */ public NBTTagCompound loadFile(File saveDirectory, String filename) { - return loadFile(new File(saveDirectory, filename + ".dat")); + return loadFile(new File(saveDirectory, filename + ".nbt")); } public NBTTagCompound loadFile(String filename) { diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/config/NovaGuiFactory.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/config/NovaGuiFactory.java index e9d82af54..84cb09be4 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/config/NovaGuiFactory.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/manager/config/NovaGuiFactory.java @@ -46,6 +46,7 @@ public GuiScreen createConfigGui(GuiScreen parentScreen) { } @Override + @Deprecated public Class mainConfigGuiClass() { return NovaGuiConfig.class; } @@ -56,6 +57,7 @@ public Set runtimeGuiCategories() { } @Override + @Deprecated public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/network/discriminator/NovaPacket.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/network/discriminator/NovaPacket.java index 15e6810e8..2a88a9fbb 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/network/discriminator/NovaPacket.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/network/discriminator/NovaPacket.java @@ -23,11 +23,10 @@ import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; -import nova.core.entity.Entity; -import nova.core.entity.component.Player; import nova.core.network.handler.PacketHandler; import nova.core.wrapper.mc.forge.v1_11_2.network.MCPacket; import nova.core.wrapper.mc.forge.v1_11_2.network.netty.MCNetworkManager; +import nova.core.wrapper.mc.forge.v1_11_2.util.WrapUtility; import nova.internal.core.Game; /** @@ -65,7 +64,7 @@ public void handle(EntityPlayer player) { MCNetworkManager network = (MCNetworkManager) Game.network(); PacketHandler packetHandler = network.getPacketType(data.readInt()); int subId = data.readInt(); - MCPacket packet = new MCPacket(data.slice(), ((Entity) Game.natives().toNova(player)).components.get(Player.class)); + MCPacket packet = new MCPacket(data.slice(), WrapUtility.getNovaPlayer(player).get()); //Set the ID of the packet packet.setID(subId); packetHandler.read(packet); diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/ReflectionUtil.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/ReflectionUtil.java index b4e84937c..64eebe236 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/ReflectionUtil.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/ReflectionUtil.java @@ -34,7 +34,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.NonNullList; import net.minecraft.util.WeightedRandom; -import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.LanguageMap; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -140,7 +139,7 @@ public static Map getChestLoot() { @SuppressWarnings("deprecation") public static Map getTranslations() { return getPrivateObject( - getPrivateStaticObject(I18n.class, "localizedName", "field_74839_a"), + getPrivateStaticObject(net.minecraft.util.text.translation.I18n.class, "localizedName", "field_74839_a"), "languageList", "field_74816_c"); } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/WrapUtility.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/WrapUtility.java index 3b19c3ef9..b9b7b7c7e 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/WrapUtility.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/util/WrapUtility.java @@ -24,11 +24,12 @@ import net.minecraft.item.Item; import nova.core.entity.Entity; import nova.core.entity.component.Player; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.EntityConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.backward.BWEntity; -import nova.internal.core.Game; import java.util.Objects; import java.util.Optional; +import javax.annotation.Nullable; /** * Wrap utility methods. @@ -38,10 +39,10 @@ public class WrapUtility { private WrapUtility() {} - public static Optional getNovaPlayer(EntityPlayer player) { + public static Optional getNovaPlayer(@Nullable EntityPlayer player) { if (player == null) return Optional.empty(); - return ((Entity)Game.natives().toNova(player)).components.getOp(Player.class); + return EntityConverter.instance().toNova(player).components.getOp(Player.class); } public static String getItemID(Item item, int meta) { diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlock.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlock.java index f0aa340b0..359665469 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlock.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlock.java @@ -81,7 +81,11 @@ public BWBlock(net.minecraft.block.Block block) { public BWBlock(IBlockState blockState, World world, Vector3D pos) { this.blockState = blockState; components.add(new BWBlockTransform(this, world, pos)); - components.add(new BlockProperty.Opacity().setOpacity(blockState().getMaterial().blocksLight() ? 1 : 0)); + components.add(new BlockProperty.Opacity()).setOpacity(() -> blockState().getMaterial().isOpaque() ? 1 : 0); + BlockProperty.Replaceable replaceable = components.add(new BlockProperty.Replaceable()); + if (block() != Blocks.AIR) { + replaceable.setReplaceable(() -> block().canPlaceBlockAt((net.minecraft.world.World) blockAccess(), blockPos())); + } BlockProperty.BlockSound blockSound = components.add(new BlockProperty.BlockSound()); SoundType soundType; @@ -135,7 +139,7 @@ public BWBlock(IBlockState blockState, World world, Vector3D pos) { } else { bb = blockState().getBoundingBox(blockAccess(), blockPos()).offset(blockPos()); } - Cuboid cuboid = Game.natives().toNova(bb); + Cuboid cuboid = CuboidConverter.instance().toNova(bb); return Collections.singleton(cuboid.subtract(position())); }); components.add(new StaticRenderer()) @@ -228,11 +232,6 @@ public Optional tile() { return Optional.ofNullable(mcTileEntity); } - @Override - public boolean canReplace() { - return block().canPlaceBlockAt((net.minecraft.world.World) blockAccess(), blockPos()); - } - @Override public boolean shouldDisplacePlacement() { if (block() == Blocks.SNOW_LAYER && (blockState().getValue(BlockSnow.LAYERS) < 1)) { @@ -254,7 +253,7 @@ public void save(Data data) { @Override public void load(Data data) { Storable.super.load(data); - tile().ifPresent(tile -> tile.deserializeNBT(Game.natives().toNative(data))); + tile().ifPresent(tile -> tile.deserializeNBT(DataConverter.instance().toNative(data))); } @Override diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockTransform.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockTransform.java index e988b474a..d04e7404b 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockTransform.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockTransform.java @@ -27,7 +27,6 @@ import nova.core.world.World; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.VectorConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.world.WorldConverter; -import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import java.util.Optional; @@ -68,8 +67,8 @@ public IBlockAccess blockAccess() { @Override public void setWorld(World world) { BlockPos pos = blockPos(); - net.minecraft.world.World oldWorld = Game.natives().toNative(this.world); - net.minecraft.world.World newWorld = Game.natives().toNative(world); + net.minecraft.world.World oldWorld = (net.minecraft.world.World) WorldConverter.instance().toNative(this.world); + net.minecraft.world.World newWorld = (net.minecraft.world.World) WorldConverter.instance().toNative(world); Optional tileEntity = Optional.ofNullable(oldWorld.getTileEntity(pos)); Optional nbt = Optional.empty(); if (tileEntity.isPresent()) { @@ -91,7 +90,7 @@ public void setWorld(World world) { public void setPosition(Vector3D position) { BlockPos oldPos = blockPos(); BlockPos newPos = VectorConverter.instance().toNative(position); - net.minecraft.world.World world = Game.natives().toNative(this.world); + net.minecraft.world.World world = (net.minecraft.world.World) WorldConverter.instance().toNative(this.world); Optional tileEntity = Optional.ofNullable(blockAccess().getTileEntity(oldPos)); Optional nbt = Optional.empty(); if (tileEntity.isPresent()) { diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java index 07525855c..ed65dbf93 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java @@ -54,6 +54,8 @@ import nova.core.wrapper.mc.forge.v1_11_2.wrapper.DirectionConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.VectorConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.world.WorldConverter; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.cuboid.CuboidConverter; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.EntityConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.item.ItemConverter; import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; @@ -116,7 +118,7 @@ private FWBlock(BlockFactory factory, Block dummy) { this.fullBlock = getDefaultState().isOpaqueCube(); this.lightOpacity = dummy.components .getOp(BlockProperty.Opacity.class) - .map(o -> MathUtil.clamp((int) Math.round(o.opacity * 255), 0, 255)) + .map(o -> MathUtil.clamp((int) Math.round(o.getOpacity() * 255), 0, 255)) .orElse(this.fullBlock ? 255 : 0); this.translucent = !this.fullBlock; } @@ -125,6 +127,10 @@ public BlockFactory getFactory() { return this.factory; } + public Block getBlockInstance(IBlockAccess access, BlockPos position) { + return getBlockInstance(access, VectorConverter.instance().toNova(position)); + } + public Block getBlockInstance(IBlockAccess access, Vector3D position) { /** * If this block has a TileEntity, forward the method into the Stateful @@ -166,7 +172,7 @@ public void onBlockHarvested(World world, BlockPos pos, IBlockState state, Entit // hack is needed because the player sets the block to air *before* // getting the drops. woo good logic from mojang. if (!player.capabilities.isCreativeMode) { - harvestedBlocks.put(new BlockPosition(world, pos.getX(), pos.getY(), pos.getZ()), getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ()))); + harvestedBlocks.put(new BlockPosition(world, pos.getX(), pos.getY(), pos.getZ()), getBlockInstance(world, pos)); } } @@ -180,7 +186,7 @@ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState st if (harvestedBlocks.containsKey(position)) { blockInstance = harvestedBlocks.remove(position); } else { - blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + blockInstance = getBlockInstance(world, pos); } Block.DropEvent event = new Block.DropEvent(blockInstance); @@ -228,15 +234,15 @@ public void neighborChanged(IBlockState state, World world, BlockPos pos, net.mi @Override public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(world, pos); Block.NeighborChangeEvent evt = new Block.NeighborChangeEvent(Optional.of(VectorConverter.instance().toNova(neighbor))); blockInstance.events.publish(evt); } @Override public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); - Block.RemoveEvent evt = new Block.RemoveEvent(Optional.of(Game.natives().toNova(player))); + Block blockInstance = getBlockInstance(world, pos); + Block.RemoveEvent evt = new Block.RemoveEvent(Optional.of(EntityConverter.instance().toNova(player))); blockInstance.events.publish(evt); if (evt.result) { return super.removedByPlayer(state, world, pos, player, willHarvest); @@ -246,9 +252,9 @@ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, Ent @Override public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(world, pos); Optional mop = Optional.ofNullable(player.rayTrace(10, 1)); - Block.LeftClickEvent evt = new Block.LeftClickEvent(Game.natives().toNova(player), + Block.LeftClickEvent evt = new Block.LeftClickEvent(EntityConverter.instance().toNova(player), DirectionConverter.instance().toNova(mop.map(m -> m.sideHit).orElse(null)), mop.map(m -> m.hitVec).map(VectorConverter.instance()::toNova).orElseGet(() -> VectorConverter.instance().toNova(pos))); blockInstance.events.publish(evt); @@ -256,22 +262,22 @@ public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) { @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); - Block.RightClickEvent evt = new Block.RightClickEvent(Game.natives().toNova(player), DirectionConverter.instance().toNova(side), new Vector3D(hitX, hitY, hitZ)); + Block blockInstance = getBlockInstance(world, pos); + Block.RightClickEvent evt = new Block.RightClickEvent(EntityConverter.instance().toNova(player), DirectionConverter.instance().toNova(side), new Vector3D(hitX, hitY, hitZ)); blockInstance.events.publish(evt); return evt.result; } @Override public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); - blockInstance.components.getOp(Collider.class).ifPresent(collider -> blockInstance.events.publish(new Collider.CollideEvent(Game.natives().toNova(entity)))); + Block blockInstance = getBlockInstance(world, pos); + blockInstance.components.getOp(Collider.class).ifPresent(collider -> blockInstance.events.publish(new Collider.CollideEvent(EntityConverter.instance().toNova(entity)))); } @Override @Deprecated public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess access, BlockPos pos) { - Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(access, pos); if (blockInstance.components.has(Collider.class)) { Cuboid cuboid = blockInstance.components.get(Collider.class).boundingBox.get(); return new AxisAlignedBB(cuboid.min.getX(), cuboid.min.getY(), cuboid.min.getZ(), cuboid.max.getX(), cuboid.max.getY(), cuboid.max.getZ()); @@ -282,14 +288,14 @@ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess access, Bloc @Override @Deprecated public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(world, pos); if (blockInstance.components.has(Collider.class)) { Collider collider = blockInstance.components.get(Collider.class); Set cuboids = collider.selectionBoxes.apply(Optional.empty()); Cuboid cuboid = cuboids.stream().reduce(collider.boundingBox.get(), (c1, c2) -> new Cuboid(Vector3DUtil.min(c1.min, c2.min), Vector3DUtil.max(c1.max, c2.max))); - return Game.natives().toNative(cuboid.add(new Vector3D(pos.getX(), pos.getY(), pos.getZ()))); + return CuboidConverter.instance().toNative(cuboid.add(VectorConverter.instance().toNova(pos))); } return super.getSelectedBoundingBox(state, world, pos); } @@ -297,17 +303,17 @@ public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, Bloc @Override @Deprecated public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB boundingBox, List list, Entity entity, boolean b) { - Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(world, pos); blockInstance.components.getOp(Collider.class).ifPresent( collider -> { - Set boxes = collider.occlusionBoxes.apply(Optional.ofNullable(entity != null ? Game.natives().toNova(entity) : null)); + Set boxes = collider.occlusionBoxes.apply(Optional.ofNullable(entity != null ? EntityConverter.instance().toNova(entity) : null)); list.addAll( boxes .stream() - .map(c -> c.add(new Vector3D(pos.getX(), pos.getY(), pos.getZ()))) - .filter(c -> c.intersects((Cuboid) Game.natives().toNova(boundingBox))) - .map(cuboid -> (AxisAlignedBB) Game.natives().toNative(cuboid)) + .map(c -> c.add(VectorConverter.instance().toNova(pos))) + .filter(c -> c.intersects(CuboidConverter.instance().toNova(boundingBox))) + .map(CuboidConverter.instance()::toNative) .collect(Collectors.toList()) ); } @@ -333,7 +339,7 @@ public boolean isOpaqueCube(IBlockState state) { @Override public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { - Optional blockCollider = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())).components.getOp(Collider.class); + Optional blockCollider = getBlockInstance(world, pos).components.getOp(Collider.class); if (blockCollider.isPresent()) { return blockCollider.get().isCube.get(); @@ -356,7 +362,7 @@ public boolean isFullCube(IBlockState state) { @Override public int getLightValue(IBlockState state, IBlockAccess access, BlockPos pos) { - Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(access, pos); Optional opEmitter = blockInstance.components.getOp(LightEmitter.class); if (opEmitter.isPresent()) { @@ -373,7 +379,7 @@ public BlockRenderLayer getBlockLayer() { @Override public boolean canConnectRedstone(IBlockState state, IBlockAccess access, BlockPos pos, EnumFacing side) { - Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(access, pos); WrapperEvent.RedstoneConnect event = new WrapperEvent.RedstoneConnect(blockInstance.world(), blockInstance.position(), Direction.fromOrdinal(side.ordinal())); Game.events().publish(event); return event.canConnect; @@ -382,7 +388,7 @@ public boolean canConnectRedstone(IBlockState state, IBlockAccess access, BlockP @Override @Deprecated public int getWeakPower(IBlockState state, IBlockAccess access, BlockPos pos, EnumFacing side) { - Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(access, pos); WrapperEvent.WeakRedstone event = new WrapperEvent.WeakRedstone(blockInstance.world(), blockInstance.position(), Direction.fromOrdinal(side.ordinal())); Game.events().publish(event); return event.power; @@ -391,7 +397,7 @@ public int getWeakPower(IBlockState state, IBlockAccess access, BlockPos pos, En @Override @Deprecated public int getStrongPower(IBlockState state, IBlockAccess access, BlockPos pos, EnumFacing side) { - Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); + Block blockInstance = getBlockInstance(access, pos); WrapperEvent.StrongRedstone event = new WrapperEvent.StrongRedstone(blockInstance.world(), blockInstance.position(), Direction.fromOrdinal(side.ordinal())); Game.events().publish(event); return event.power; @@ -410,12 +416,43 @@ public String getLocalizedName() { @Override public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) { // TODO: Maybe do something withPriority these parameters. - return (float) getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())).getResistance() * 30; + + // This number was calculated from the blast resistance of Stone, + // which requires exactly one cubic meter of TNT to get blown up. + // + // 1. During construction, the setResistance method is called + // on minecraft:stone with a value of 10. + // + // 2. The setResistance method multiplies that by 3 and assigns + // the result to the blockResistance instance variable. + // + // 3. Finally, the getExplosionResistance method divides the + // blockResistance instance variable by 5 and returns the result. + // + // From this we see that minecraft:stone’s final blast resistance is 6. + + return (float) getBlockInstance(world, pos).getResistance() * 6; } @Override @Deprecated public float getBlockHardness(IBlockState state, World world, BlockPos pos) { - return (float) getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())).getHardness() * 2; + return (float) getBlockInstance(world, pos).getHardness() * 2; + } + + @Override + public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) { + return getBlockInstance(world, pos) + .components.getOp(BlockProperty.Opacity.class) + .map(o -> MathUtil.clamp((int) Math.round(o.getOpacity() * 255), 0, 255)) + .orElse(this.fullBlock ? 255 : 0); + } + + @Override + public boolean isReplaceable(IBlockAccess world, BlockPos pos) { + return getBlockInstance(world, pos) + .components.getOp(BlockProperty.Replaceable.class) + .filter(BlockProperty.Replaceable::isReplaceable) + .isPresent(); } } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWTile.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWTile.java index 1d06976ec..0a18833ac 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWTile.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWTile.java @@ -41,6 +41,7 @@ import nova.core.wrapper.mc.forge.v1_11_2.network.netty.MCNetworkManager; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.DirectionConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.capability.forward.NovaCapabilityProvider; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.data.DataConverter; import nova.internal.core.Game; import java.io.IOException; @@ -115,7 +116,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { if (block instanceof Storable) { Data data = new Data(); ((Storable) block).save(data); - nbt.setTag("nova", Game.natives().toNative(data)); + nbt.setTag("nova", DataConverter.instance().toNative(data)); } } @@ -127,7 +128,7 @@ public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); blockID = nbt.getString("novaID"); - cacheData = Game.natives().toNova(nbt.getCompoundTag("nova")); + cacheData = DataConverter.instance().toNova(nbt.getCompoundTag("nova")); } @Override diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/ProxyMaterial.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/ProxyMaterial.java index f65de03c8..db920ac5b 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/ProxyMaterial.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/ProxyMaterial.java @@ -17,7 +17,7 @@ public class ProxyMaterial extends Material { * Construct a new proxy material. * @param color The map color. * @param opacity The Opacity to use. - * @param replaceable The Replaceable to use. + * @param replaceable If this block is replaceable. */ public ProxyMaterial(MapColor color, Optional opacity, Optional replaceable) { super(color); @@ -27,16 +27,16 @@ public ProxyMaterial(MapColor color, Optional opacity, Op @Override public boolean blocksLight() { - return opacity.isPresent() ? opacity.get().opacity == 1 : super.blocksLight(); + return opacity.map(BlockProperty.Opacity::isOpaque).orElseGet(super::blocksLight); } @Override public boolean isOpaque() { - return opacity.isPresent() ? opacity.get().opacity == 1 : super.isOpaque(); + return opacity.map(BlockProperty.Opacity::isOpaque).orElseGet(super::isOpaque); } @Override public boolean isReplaceable() { - return replaceable.isPresent() || super.isReplaceable(); + return replaceable.map(BlockProperty.Replaceable::isReplaceable).orElseGet(super::isReplaceable); } } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/world/BWWorld.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/world/BWWorld.java index 87fcf906f..88ba22ae9 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/world/BWWorld.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/world/BWWorld.java @@ -26,7 +26,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import nova.core.block.Block; import nova.core.block.BlockFactory; @@ -47,6 +46,7 @@ import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.EntityConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.forward.FWEntity; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.entity.forward.MCEntityTransform; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.item.ItemConverter; import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; @@ -137,8 +137,9 @@ public Entity addClientEntity(EntityFactory factory) { } @Override - public Entity addClientEntity(Entity entity) { - return NovaMinecraft.proxy.spawnParticle(world(), entity); + @SuppressWarnings("unchecked") + public T addClientEntity(T entity) { + return (T) NovaMinecraft.proxy.spawnParticle(world(), entity); } @Override @@ -163,14 +164,14 @@ public Set getEntities(Cuboid bound) { @Override public Entity addEntity(Vector3D position, Item item) { - EntityItem entityItem = new EntityItem(world(), position.getX(), position.getY(), position.getZ(), Game.natives().toNative(item)); + EntityItem entityItem = new EntityItem(world(), position.getX(), position.getY(), position.getZ(), ItemConverter.instance().toNative(item)); world().spawnEntity(entityItem); - return Game.natives().toNova(entityItem); + return EntityConverter.instance().toNova(entityItem); } @Override public Optional getEntity(String uniqueID) { - return Optional.ofNullable(Game.natives().toNova(world().getEntityByID(Integer.parseInt(uniqueID)))); + return Optional.ofNullable(EntityConverter.instance().toNova(world().getEntityByID(Integer.parseInt(uniqueID)))); } @Override diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/capability/forward/NovaCapabilityProvider.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/capability/forward/NovaCapabilityProvider.java index 3ee9c6371..01b42ecec 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/capability/forward/NovaCapabilityProvider.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/capability/forward/NovaCapabilityProvider.java @@ -42,9 +42,10 @@ public interface NovaCapabilityProvider extends ICapabilityProvider { * for a capability. *

* Example: - * A Pipe getting a cover placed on one side causing it loose the {@link nova.core.component.inventory.Inventory} attachment function for that side. + * A Pipe getting a cover placed on one side causing it lose the + * {@link nova.core.component.inventory.Inventory} attachment function for that side. * - * @param capability The capability to check + * @param capability The capability to check. * @param direction The Side to check from: @link nova.core.util.Direction.UNKNOWN UNKNOWN} * is defined to represent 'internal' or 'self' or used for cases where side doesn't matter. * @return True if this object supports the capability for this side. @@ -61,10 +62,12 @@ default boolean hasCapability(@Nonnull Capability capability, @Nullable EnumF * The return value is {@link Optional#empty()} when the object does not support the capability for the direction. * The return value can be the same for multiple faces. *

- * @param capability The capability to check + * @param capability The capability to check. * @param direction The Side to check from: @link nova.core.util.Direction.UNKNOWN UNKNOWN} * is defined to represent 'internal' or 'self' or used for cases where side doesn't matter. - * @return The requested capability. Returns an empty optional when {@link #hasCapability(Capability, EnumFacing)} would return false. + * @param The capability type to check. + * @return The requested capability. Returns an empty optional when + * {@link #hasCapability(Capability, EnumFacing)} would return false. */ @Nonnull Optional getCapability(@Nonnull Capability capability, @Nonnull Direction direction); diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/FWEntity.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/FWEntity.java index 1f6da4560..fd8cebded 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/FWEntity.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/FWEntity.java @@ -41,15 +41,14 @@ import nova.core.wrapper.mc.forge.v1_11_2.util.WrapperEvent; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.DirectionConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.capability.forward.NovaCapabilityProvider; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.cuboid.CuboidConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.data.DataConverter; import nova.internal.core.Game; import java.util.Optional; - import javax.annotation.Nonnull; import javax.annotation.Nullable; - /** * Entity wrapper * @author Calclavia @@ -74,7 +73,7 @@ public FWEntity(World world, EntityFactory factory) { @Override protected void readEntityFromNBT(NBTTagCompound nbt) { if (wrapped instanceof Storable) { - ((Storable) wrapped).load(Game.natives().toNova(nbt)); + ((Storable) wrapped).load(DataConverter.instance().toNova(nbt)); } if (wrapped == null) { //This entity was saved to disk. @@ -208,9 +207,9 @@ public void setPosition(double x, double y, double z) { this.posY = y; this.posZ = z; //Reset the bounding box - if (getCollisionBoundingBox() != null) { - setBounds(Game.natives().toNova(getCollisionBoundingBox())); - } + Optional.ofNullable(getCollisionBoundingBox()) + .map(CuboidConverter.instance()::toNova) + .ifPresent(this::setBounds); } /** @@ -219,9 +218,11 @@ public void setPosition(double x, double y, double z) { */ public void setBounds(Cuboid bounds) { //TODO: Fix moveEntity auto-centering - if (transform != null) { - setEntityBoundingBox(Game.natives().toNative(bounds.add(transform.position()))); - } + Optional.ofNullable(transform) + .map(EntityTransform::position) + .map(bounds::add) + .map(CuboidConverter.instance()::toNative) + .ifPresent(this::setEntityBoundingBox); } @Override diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/MCEntityTransform.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/MCEntityTransform.java index 92001cce8..23814613b 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/MCEntityTransform.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/entity/forward/MCEntityTransform.java @@ -22,9 +22,11 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.common.DimensionManager; import nova.core.component.transform.EntityTransform; +import nova.core.util.UniqueIdentifiable; import nova.core.util.math.RotationUtil; import nova.core.util.math.Vector3DUtil; import nova.core.world.World; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.world.WorldConverter; import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; @@ -35,7 +37,7 @@ * Wraps Transform3d used in entity * @author Calclavia */ -public class MCEntityTransform extends EntityTransform { +public class MCEntityTransform extends EntityTransform implements UniqueIdentifiable { public final net.minecraft.entity.Entity wrapper; public MCEntityTransform(net.minecraft.entity.Entity wrapper) { @@ -46,7 +48,7 @@ public MCEntityTransform(net.minecraft.entity.Entity wrapper) { @Override public World world() { - return Game.natives().toNova(wrapper.world); + return WorldConverter.instance().toNova(wrapper.world); } @Override @@ -81,4 +83,9 @@ public void setRotation(Rotation rotation) { wrapper.rotationYaw = (float) Math.toDegrees(euler[0]); wrapper.rotationPitch = (float) Math.toDegrees(euler[1]); } + + @Override + public String getUniqueID() { + return wrapper.getUniqueID().toString(); + } } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/inventory/BWInventory.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/inventory/BWInventory.java index 4ba4e84e3..ee9e28e69 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/inventory/BWInventory.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/inventory/BWInventory.java @@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack; import nova.core.component.inventory.Inventory; import nova.core.item.Item; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.item.ItemConverter; import nova.internal.core.Game; import java.util.Optional; @@ -36,19 +37,13 @@ public BWInventory(IInventory mcInventory) { } @Override - public Optional get(int i) { - ItemStack stackInSlot = wrapped.getStackInSlot(i); - - if (stackInSlot == null) { - return Optional.empty(); - } - - return Optional.of(Game.natives().toNova(stackInSlot)); + public Optional get(int slot) { + return Optional.ofNullable(wrapped.getStackInSlot(slot)).map(ItemConverter.instance()::toNova); } @Override - public boolean set(int i, Item item) { - wrapped.setInventorySlotContents(i, Game.natives().toNative(item)); + public boolean set(int slot, Item item) { + wrapped.setInventorySlotContents(slot, ItemConverter.instance().toNative(item)); return true; } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/particle/forward/MCParticleTransform.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/particle/forward/MCParticleTransform.java index 39c2bf61f..088b2bec2 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/particle/forward/MCParticleTransform.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/particle/forward/MCParticleTransform.java @@ -10,6 +10,7 @@ import nova.core.util.math.RotationUtil; import nova.core.util.math.Vector3DUtil; import nova.core.world.World; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.world.WorldConverter; import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; @@ -28,7 +29,7 @@ public MCParticleTransform(Particle wrapper) { @Override public World world() { - return Game.natives().toNova(wrapper.world); + return WorldConverter.instance().toNova(wrapper.world); } @Override diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartBlockModel.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartBlockModel.java index 226460eee..8281360a9 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartBlockModel.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartBlockModel.java @@ -24,7 +24,6 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -65,14 +64,14 @@ public FWSmartBlockModel(Block block, Optional item) { this.item = item; // Change the default transforms to the default full Block transforms this.itemCameraTransforms = new ItemCameraTransforms( - new ItemTransformVec3f(new Vector3f(75, 225, 0), new Vector3f(0, 0.1875f, 0.03125f), new Vector3f(0.375f, 0.375f, 0.375f)), // Third Person (Left) - new ItemTransformVec3f(new Vector3f(75, 45, 0), new Vector3f(0, 0.1875f, 0.03125f), new Vector3f(0.375f, 0.375f, 0.375f)), // Third Person (Right) - new ItemTransformVec3f(new Vector3f(0, 225, 0), new Vector3f(0, 0, 0), new Vector3f(0.4f, 0.4f, 0.4f)), // First Person (Left) - new ItemTransformVec3f(new Vector3f(0, 45, 0), new Vector3f(0, 0, 0), new Vector3f(0.4f, 0.4f, 0.4f)), // First Person (Right) - ItemTransformVec3f.DEFAULT, // Head - new ItemTransformVec3f(new Vector3f(30, 225, 0), new Vector3f(0, 0, 0), new Vector3f(0.625f, 0.625f, 0.625f)), // GUI - ItemTransformVec3f.DEFAULT, // Ground - ItemTransformVec3f.DEFAULT);// Fixed + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(75, 225, 0), new Vector3f(0, 0.1875f, 0.03125f), new Vector3f(0.375f, 0.375f, 0.375f)), // Third Person (Left) + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(75, 45, 0), new Vector3f(0, 0.1875f, 0.03125f), new Vector3f(0.375f, 0.375f, 0.375f)), // Third Person (Right) + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(0, 225, 0), new Vector3f(0, 0, 0), new Vector3f(0.4f, 0.4f, 0.4f)), // First Person (Left) + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(0, 45, 0), new Vector3f(0, 0, 0), new Vector3f(0.4f, 0.4f, 0.4f)), // First Person (Right) + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT, // Head + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(30, 225, 0), new Vector3f(0, 0, 0), new Vector3f(0.625f, 0.625f, 0.625f)), // GUI + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT, // Ground + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT);// Fixed } //Item rendering diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartItemModel.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartItemModel.java index eba2fcbdb..c40463c17 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartItemModel.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/render/forward/FWSmartItemModel.java @@ -25,7 +25,6 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -52,14 +51,14 @@ public FWSmartItemModel(Item item) { this.item = item; // Change the default transforms to the default Item transforms this.itemCameraTransforms = new ItemCameraTransforms( - new ItemTransformVec3f(new Vector3f(0, -90, -130), new Vector3f(0, 1f / 24f, -2.75f / 16f), new Vector3f(0.9f, 0.9f, 0.9f)), // Third Person (Left) - new ItemTransformVec3f(new Vector3f(0, -90, -130), new Vector3f(0, 1f / 24f, -2.75f / 16f), new Vector3f(0.9f, 0.9f, 0.9f)), // Third Person (Right) - new ItemTransformVec3f(new Vector3f(0, -135, 25), new Vector3f(0, 0.25f, 0.125f), new Vector3f(1.7f, 1.7f, 1.7f)), // First Person (Left) - new ItemTransformVec3f(new Vector3f(0, -135, 25), new Vector3f(0, 0.25f, 0.125f), new Vector3f(1.7f, 1.7f, 1.7f)), // First Person (Rigth) - ItemTransformVec3f.DEFAULT, // Head - ItemTransformVec3f.DEFAULT, // new ItemTransformVec3f(new Vector3f(-30, 135, 0), new Vector3f(), new Vector3f(1.6F, 1.6F, 1.6F)), // GUI - ItemTransformVec3f.DEFAULT, // Ground - ItemTransformVec3f.DEFAULT);// Fixed + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(0, -90, -130), new Vector3f(0, 1f / 24f, -2.75f / 16f), new Vector3f(0.9f, 0.9f, 0.9f)), // Third Person (Left) + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(0, -90, -130), new Vector3f(0, 1f / 24f, -2.75f / 16f), new Vector3f(0.9f, 0.9f, 0.9f)), // Third Person (Right) + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(0, -135, 25), new Vector3f(0, 0.25f, 0.125f), new Vector3f(1.7f, 1.7f, 1.7f)), // First Person (Left) + new net.minecraft.client.renderer.block.model.ItemTransformVec3f(new Vector3f(0, -135, 25), new Vector3f(0, 0.25f, 0.125f), new Vector3f(1.7f, 1.7f, 1.7f)), // First Person (Rigth) + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT, // Head + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT, // new ItemTransformVec3f(new Vector3f(-30, 135, 0), new Vector3f(), new Vector3f(1.6F, 1.6F, 1.6F)), // GUI + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT, // Ground + net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT);// Fixed } //Item rendering