diff --git a/build.gradle b/build.gradle index c5c747a..8ef1276 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,8 @@ allprojects { } maven { url 'https://hephaestus.dev/release' } maven { url 'https://repo.repsy.io/mvn/gandiber/geckolib' } + maven { url 'https://maven.shedaniel.me' } + maven { url 'https://maven.fabricmc.net/io/github/prospector/modmenu' } jcenter() } @@ -53,6 +55,12 @@ allprojects { modImplementation 'software.bernie.geckolib:geckolib-fabric-1.16.5:3.0.30:dev' include 'software.bernie.geckolib:geckolib-fabric-1.16.5:3.0.30:dev' + modImplementation('io.github.prospector:modmenu:1.16.9') + + modImplementation("me.shedaniel.cloth:cloth-config-fabric:4.11.14") { + exclude(group: "net.fabricmc.fabric-api") + } + // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. } diff --git a/src/main/java/tk/meowmc/portalgun/Portalgun.java b/src/main/java/tk/meowmc/portalgun/Portalgun.java index d604198..9ed2676 100644 --- a/src/main/java/tk/meowmc/portalgun/Portalgun.java +++ b/src/main/java/tk/meowmc/portalgun/Portalgun.java @@ -11,6 +11,7 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import tk.meowmc.portalgun.config.PortalGunConfig; import tk.meowmc.portalgun.items.PortalGunItem; public class Portalgun implements ModInitializer { @@ -33,9 +34,11 @@ public class Portalgun implements ModInitializer { public static SoundEvent PORTAL_CLOSE_EVENT = new SoundEvent(PORTAL_CLOSE); public static Logger LOGGER = LogManager.getLogger(); + public static void logString(Level level, String message) { LOGGER.log(level, "[" + MOD_NAME + "] " + message); } + public static void logInt(Level level, int message) { LOGGER.log(level, "[" + MOD_NAME + "] " + message); } @@ -55,6 +58,8 @@ public void onInitialize() { Registry.register(Registry.SOUND_EVENT, PORTAL2_SHOOT, PORTAL2_SHOOT_EVENT); Registry.register(Registry.SOUND_EVENT, PORTAL_OPEN, PORTAL_OPEN_EVENT); Registry.register(Registry.SOUND_EVENT, PORTAL_CLOSE, PORTAL_CLOSE_EVENT); + + PortalGunConfig.register(); } diff --git a/src/main/java/tk/meowmc/portalgun/client/PortalgunClient.java b/src/main/java/tk/meowmc/portalgun/client/PortalgunClient.java index 1c1ec5c..7f63697 100644 --- a/src/main/java/tk/meowmc/portalgun/client/PortalgunClient.java +++ b/src/main/java/tk/meowmc/portalgun/client/PortalgunClient.java @@ -10,6 +10,9 @@ import net.minecraft.client.options.KeyBinding; import net.minecraft.client.util.InputUtil; import org.lwjgl.glfw.GLFW; +import software.bernie.geckolib3.renderer.geo.GeoItemRenderer; +import tk.meowmc.portalgun.Portalgun; +import tk.meowmc.portalgun.client.renderer.PortalGunRenderer; @Environment(EnvType.CLIENT) public class PortalgunClient implements ClientModInitializer { @@ -44,5 +47,7 @@ public void onInitializeClient() { } } }); + + GeoItemRenderer.registerItemRenderer(Portalgun.PORTALGUN, new PortalGunRenderer()); } } diff --git a/src/main/java/tk/meowmc/portalgun/client/renderer/PortalGunRenderer.java b/src/main/java/tk/meowmc/portalgun/client/renderer/PortalGunRenderer.java new file mode 100644 index 0000000..8c8bb14 --- /dev/null +++ b/src/main/java/tk/meowmc/portalgun/client/renderer/PortalGunRenderer.java @@ -0,0 +1,11 @@ +package tk.meowmc.portalgun.client.renderer; + +import software.bernie.geckolib3.renderer.geo.GeoItemRenderer; +import tk.meowmc.portalgun.client.renderer.models.PortalGunModel; +import tk.meowmc.portalgun.items.PortalGunItem; + +public class PortalGunRenderer extends GeoItemRenderer { + public PortalGunRenderer() { + super(new PortalGunModel()); + } +} diff --git a/src/main/java/tk/meowmc/portalgun/client/renderer/models/PortalGunModel.java b/src/main/java/tk/meowmc/portalgun/client/renderer/models/PortalGunModel.java new file mode 100644 index 0000000..8d835e0 --- /dev/null +++ b/src/main/java/tk/meowmc/portalgun/client/renderer/models/PortalGunModel.java @@ -0,0 +1,37 @@ +package tk.meowmc.portalgun.client.renderer.models; + +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.util.Identifier; +import software.bernie.geckolib3.model.AnimatedGeoModel; +import tk.meowmc.portalgun.config.PortalGunConfig; +import tk.meowmc.portalgun.items.PortalGunItem; + +import static tk.meowmc.portalgun.Portalgun.id; + +public class PortalGunModel extends AnimatedGeoModel { + PortalGunConfig config = AutoConfig.getConfigHolder(PortalGunConfig.class).getConfig(); + + @Override + public Identifier getModelLocation(PortalGunItem object) { + /*if (config.enabled.enableOldPortalGunModel) + return id("geo/portalgun_og.geo.json"); + else*/ + return id("geo/portalgun.geo.json"); + } + + @Override + public Identifier getTextureLocation(PortalGunItem object) { + /*if (config.enabled.enableOldPortalGunModel) + return id("textures/item/portal_gun_og.png"); + else*/ + return id("textures/item/portal_gun.png"); + } + + @Override + public Identifier getAnimationFileLocation(PortalGunItem animatable) { + /*if (config.enabled.enableOldPortalGunModel) + return id("animations/portalgun_og.animation.json"); + else*/ + return id("animations/portalgun.animation.json"); + } +} diff --git a/src/main/java/tk/meowmc/portalgun/config/ModMenuIntegration.java b/src/main/java/tk/meowmc/portalgun/config/ModMenuIntegration.java new file mode 100644 index 0000000..abe9989 --- /dev/null +++ b/src/main/java/tk/meowmc/portalgun/config/ModMenuIntegration.java @@ -0,0 +1,12 @@ +package tk.meowmc.portalgun.config; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import me.shedaniel.autoconfig.AutoConfig; + +public class ModMenuIntegration implements ModMenuApi { + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return parent -> AutoConfig.getConfigScreen(PortalGunConfig.class, parent).get(); + } +} diff --git a/src/main/java/tk/meowmc/portalgun/config/PortalGunConfig.java b/src/main/java/tk/meowmc/portalgun/config/PortalGunConfig.java new file mode 100644 index 0000000..d705176 --- /dev/null +++ b/src/main/java/tk/meowmc/portalgun/config/PortalGunConfig.java @@ -0,0 +1,34 @@ +package tk.meowmc.portalgun.config; + +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.ConfigData; +import me.shedaniel.autoconfig.annotation.Config; +import me.shedaniel.autoconfig.annotation.ConfigEntry; +import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; +import tk.meowmc.portalgun.Portalgun; + +@Config(name = Portalgun.MODID) +public class PortalGunConfig implements ConfigData { + @ConfigEntry.Gui.TransitiveObject + @ConfigEntry.Category("enabled") + public final Enabled enabled = new Enabled(); + + public static void register() { + AutoConfig.register(PortalGunConfig.class, JanksonConfigSerializer::new); + } + + public static PortalGunConfig get() { + return AutoConfig.getConfigHolder(PortalGunConfig.class).getConfig(); + } + + public static void save() { + AutoConfig.getConfigHolder(PortalGunConfig.class).save(); + } + + + public static class Enabled { + /*public final boolean enableOldPortalGunModel = false;*/ + public final boolean enableRoundPortals = true; + } + +} diff --git a/src/main/java/tk/meowmc/portalgun/ducks/IEEntity.java b/src/main/java/tk/meowmc/portalgun/ducks/IEEntity.java new file mode 100644 index 0000000..476a9aa --- /dev/null +++ b/src/main/java/tk/meowmc/portalgun/ducks/IEEntity.java @@ -0,0 +1,6 @@ +package tk.meowmc.portalgun.ducks; + +public interface IEEntity { + long collidingPortalActiveTickTime = 0; + int age = 0; +} diff --git a/src/main/java/tk/meowmc/portalgun/items/PortalGunItem.java b/src/main/java/tk/meowmc/portalgun/items/PortalGunItem.java index cfe058e..3d8124a 100644 --- a/src/main/java/tk/meowmc/portalgun/items/PortalGunItem.java +++ b/src/main/java/tk/meowmc/portalgun/items/PortalGunItem.java @@ -24,6 +24,14 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; import tk.meowmc.portalgun.Portalgun; import tk.meowmc.portalgun.client.PortalgunClient; import tk.meowmc.portalgun.misc.PortalMethods; @@ -34,8 +42,10 @@ import static net.minecraft.util.hit.HitResult.Type.MISS; import static tk.meowmc.portalgun.misc.PortalMethods.*; -public class PortalGunItem extends Item { +public class PortalGunItem extends Item implements IAnimatable { public static final String KEY = Portalgun.MODID + ":portalgun_portals"; + public String controllerName = "portalgunController"; + public AnimationFactory factory = new AnimationFactory(this); public static HitResult hit; public static BlockHitResult blockHit; public static BlockPos blockPos; @@ -62,15 +72,33 @@ public PortalGunItem(Settings settings) { super(settings); } - public static void removeOldPortals(CompoundTag tag, CompoundTag portalsTag, Entity portal1, Entity portal2) { - if (portal1 != null && portal2 != null) { + private

PlayState predicate(AnimationEvent

event) { + return PlayState.CONTINUE; + } + + @Override + public void registerControllers(AnimationData animationData) { + AnimationController controller = new AnimationController(this, controllerName, 1, this::predicate); + animationData.addAnimationController(controller); + } + + @Override + public AnimationFactory getFactory() { + return this.factory; + } + + public static void removeOldPortals(CompoundTag tag, CompoundTag portalsTag, Entity portal1, Entity portal2, World world) { + if (portal1 != null) { portal1.kill(); + portalsTag.remove("Left" + "Portal"); + newPortal1.removed = false; + } + if (portal2 != null) { portal2.kill(); + portalsTag.remove("Right" + "Portal"); + newPortal2.removed = false; } - portalsTag.remove("Left" + "Portal"); - portalsTag.remove("Right" + "Portal"); - newPortal1.removed = false; - newPortal2.removed = false; + tag.remove(world.getRegistryKey().toString()); } @Override @@ -98,6 +126,8 @@ public void portal1Spawn(World world, PlayerEntity user, Hand hand) { blockHit = (BlockHitResult) hit; blockPos = blockHit.getBlockPos(); blockState = world.getBlockState(blockPos); + AnimationController controller = GeckoLibUtil.getControllerForStack(factory, itemStack, controllerName); + if (hit.getType() == BLOCK && PortalgunClient.delay) { direction = blockHit.getSide(); @@ -198,21 +228,24 @@ public void portal1Spawn(World world, PlayerEntity user, Hand hand) { SoundCategory.NEUTRAL, 1.0F, 1F); - - + controller.markNeedsReload(); + controller.transitionLengthTicks = 3; + controller.setAnimation(new AnimationBuilder().addAnimation("portal_shoot", false)); if (portalsTag.contains("Left" + "Portal")) { - newPortal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); - if (newPortal1 != null) { + portal1 = newPortal1.world != null ? (Portal) ((ServerWorld) newPortal1.world).getEntity(portalsTag.getUuid("Left" + "Portal")) : (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); + if (portal1 == null) + newPortal1 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + else portal1Exists = true; - } } if (portalsTag.contains("Right" + "Portal")) { - newPortal2 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); - if (newPortal2 != null) { + portal2 = newPortal2.world != null ? (Portal) ((ServerWorld) newPortal2.world).getEntity(portalsTag.getUuid("Right" + "Portal")) : (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); + if (portal2 == null) + newPortal2 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + else portal2Exists = true; - } } if (notSnowUp(direction) || isSnowUp(direction)) { @@ -232,10 +265,6 @@ public void portal1Spawn(World world, PlayerEntity user, Hand hand) { ModMain.serverTaskList.addTask(TaskList.withDelay(delay, TaskList.oneShotTask(() -> { if (McHelper.getServer().getThread() == Thread.currentThread()) { - if (portalsTag.contains("Left" + "Portal") && portalsTag.contains("Right" + "Portal")) { - portal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); - portal2 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); - } world.playSound(null, newPortal1.getX(), newPortal1.getY(), @@ -244,9 +273,14 @@ public void portal1Spawn(World world, PlayerEntity user, Hand hand) { SoundCategory.NEUTRAL, 1.0F, 1F); - removeOldPortals(tag, portalsTag, portal1, portal2); - McHelper.spawnServerEntity(newPortal1); - McHelper.spawnServerEntity(newPortal2); + if (!portal1Exists && !portal2Exists) { + removeOldPortals(tag, portalsTag, portal1, portal2, world); + McHelper.spawnServerEntity(newPortal1); + McHelper.spawnServerEntity(newPortal2); + } else { + newPortal1.reloadAndSyncToClient(); + newPortal2.reloadAndSyncToClient(); + } } waitPortal = false; if (newPortal2 != null) { @@ -276,6 +310,7 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han blockHit = (BlockHitResult) hit; blockPos = blockHit.getBlockPos(); blockState = world.getBlockState(blockPos); + AnimationController controller = GeckoLibUtil.getControllerForStack(this.factory, itemStack, controllerName); if (hit.getType() == MISS) return TypedActionResult.fail(itemStack); @@ -361,12 +396,11 @@ else if (hit.getType() == BLOCK) { int delay = (int) (0.5 * distance); - client.attackCooldown = 10; - client.gameRenderer.firstPersonRenderer.resetEquipProgress(user.getActiveHand()); + controller.markNeedsReload(); + controller.setAnimation(new AnimationBuilder().addAnimation("portal_shoot", false)); if (!world.isClient) { if (!waitPortal && !space1BlockState.isOpaque() && space2BlockState.isOpaque() && !space3BlockState.isOpaque()) { - world.playSound(null, user.getX(), user.getY(), @@ -378,16 +412,22 @@ else if (hit.getType() == BLOCK) { if (portalsTag.contains("Left" + "Portal")) { newPortal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); - if (newPortal1 != null) { - portal1Exists = true; + if (portal1 == null) { + newPortal1 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + portal1Exists = false; } + else + portal1Exists = true; } if (portalsTag.contains("Right" + "Portal")) { newPortal2 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); - if (newPortal2 != null) { - portal2Exists = true; + if (newPortal2 == null) { + newPortal2 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + portal2Exists = false; } + else + portal2Exists = true; } @@ -402,10 +442,6 @@ else if (hit.getType() == BLOCK) { ModMain.serverTaskList.addTask(TaskList.withDelay(delay, TaskList.oneShotTask(() -> { if (McHelper.getServer().getThread() == Thread.currentThread()) { - if (portalsTag.contains("Left" + "Portal") && portalsTag.contains("Right" + "Portal")) { - portal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); - portal2 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); - } world.playSound(null, newPortal2.getX(), newPortal2.getY(), @@ -414,9 +450,14 @@ else if (hit.getType() == BLOCK) { SoundCategory.NEUTRAL, 1.0F, 1F); - removeOldPortals(tag, portalsTag, portal1, portal2); - McHelper.spawnServerEntity(newPortal1); - McHelper.spawnServerEntity(newPortal2); + if (!portal1Exists && !portal2Exists) { + removeOldPortals(tag, portalsTag, portal1, portal2, world); + McHelper.spawnServerEntity(newPortal1); + McHelper.spawnServerEntity(newPortal2); + } else { + newPortal1.reloadAndSyncToClient(); + newPortal2.reloadAndSyncToClient(); + } } waitPortal = false; if (newPortal2 != null) { @@ -434,7 +475,6 @@ else if (hit.getType() == BLOCK) { user.incrementStat(Stats.USED.getOrCreateStat(this)); } - return TypedActionResult.pass(itemStack); + return TypedActionResult.fail(itemStack); } - } diff --git a/src/main/java/tk/meowmc/portalgun/misc/CollisionMethods.java b/src/main/java/tk/meowmc/portalgun/misc/CollisionMethods.java new file mode 100644 index 0000000..1e466a1 --- /dev/null +++ b/src/main/java/tk/meowmc/portalgun/misc/CollisionMethods.java @@ -0,0 +1,9 @@ +package tk.meowmc.portalgun.misc; + + +public class CollisionMethods { + + public static boolean isRecentlyCollidingWithPortal_pg(int age, long collidingPortalActiveTickTime) { + return (long)age - collidingPortalActiveTickTime < 5L; + } +} diff --git a/src/main/java/tk/meowmc/portalgun/misc/MinecraftClientMethods.java b/src/main/java/tk/meowmc/portalgun/misc/MinecraftClientMethods.java index 1011377..3dee234 100644 --- a/src/main/java/tk/meowmc/portalgun/misc/MinecraftClientMethods.java +++ b/src/main/java/tk/meowmc/portalgun/misc/MinecraftClientMethods.java @@ -1,7 +1,6 @@ package tk.meowmc.portalgun.misc; import com.qouteall.immersive_portals.ClientWorldLoader; -import com.qouteall.immersive_portals.block_manipulation.BlockManipulationServer; import com.qouteall.immersive_portals.commands.PortalCommand; import com.qouteall.immersive_portals.portal.Portal; import com.qouteall.immersive_portals.portal.PortalPlaceholderBlock; @@ -10,10 +9,8 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.world.ClientWorld; import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.Pair; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; @@ -29,7 +26,7 @@ import static tk.meowmc.portalgun.Portalgun.PORTALGUN; -@SuppressWarnings({"ReturnOfNull", "UnnecessaryReturnStatement"}) +@SuppressWarnings({"ReturnOfNull"}) public class MinecraftClientMethods { private static final MinecraftClient client = MinecraftClient.getInstance(); public static RegistryKey remotePointedDim; @@ -127,7 +124,7 @@ private static void updateTargetedBlockThroughPortal(Vec3d cameraPos, Vec3d view } public static void myHandleBlockBreaking(boolean isKeyPressed) { - if (/* !client.player.isUsingItem() && */ !client.player.isHolding(PORTALGUN)) { + if (!client.player.isUsingItem() && !client.player.isHolding(PORTALGUN)) { if (isKeyPressed && isPointingToPortal()) { BlockHitResult blockHitResult = (BlockHitResult) remoteHitResult; BlockPos blockPos = blockHitResult.getBlockPos(); @@ -183,7 +180,7 @@ public static void doAttack() { if (client.attackCooldown <= 0) { if (client.crosshairTarget == null) { Portalgun.LOGGER.error("Null returned as 'hitResult', this shouldn't happen!"); - if (client.interactionManager.hasLimitedAttackSpeed()) { + if (client.interactionManager.hasLimitedAttackSpeed() && !client.player.isHolding(PORTALGUN)) { client.attackCooldown = 10; } @@ -198,14 +195,14 @@ public static void doAttack() { if (!client.world.getBlockState(blockPos).isAir() && !client.player.isHolding(PORTALGUN)) { client.interactionManager.attackBlock(blockPos, blockHitResult.getSide()); break; - } else if (!client.world.getBlockState(blockPos).isAir() && client.player.isHolding(PORTALGUN)) - client.attackCooldown = 10; + } /*else if (!client.world.getBlockState(blockPos).isAir() && client.player.isHolding(PORTALGUN)) + client.attackCooldown = 10;*/ case MISS: - if (client.interactionManager.hasLimitedAttackSpeed() || client.player.isHolding(PORTALGUN)) { + if (client.interactionManager.hasLimitedAttackSpeed() && !client.player.isHolding(PORTALGUN)) { client.attackCooldown = 10; } - - client.player.resetLastAttackedTicks(); + if (!client.player.isHolding(PORTALGUN)) + client.player.resetLastAttackedTicks(); } if (!client.player.isHolding(PORTALGUN)) client.player.swingHand(Hand.MAIN_HAND); @@ -213,44 +210,6 @@ public static void doAttack() { } } - public static void myItemUse(Hand hand) { - ClientWorld targetWorld = ClientWorldLoader.getWorld(remotePointedDim); - ItemStack itemStack = client.player.getStackInHand(hand); - BlockHitResult blockHitResult = (BlockHitResult) remoteHitResult; - Pair> result = BlockManipulationServer.getHitResultForPlacing(targetWorld, blockHitResult); - blockHitResult = (BlockHitResult) result.getLeft(); - targetWorld = ClientWorldLoader.getWorld((RegistryKey) result.getRight()); - remoteHitResult = blockHitResult; - remotePointedDim = (RegistryKey) result.getRight(); - int i = itemStack.getCount(); - ActionResult actionResult2 = myInteractBlock(hand, targetWorld, blockHitResult); - if (!actionResult2.isAccepted()) { - if (actionResult2 != ActionResult.FAIL) { - if (!itemStack.isEmpty()) { - ActionResult actionResult3 = client.interactionManager.interactItem(client.player, targetWorld, hand); - if (actionResult3.isAccepted()) { - if (actionResult3.shouldSwingHand() && !client.player.isHolding(PORTALGUN)) { - client.player.swingHand(hand); - } - - client.gameRenderer.firstPersonRenderer.resetEquipProgress(hand); - return; - } - } - - } - } else { - if (actionResult2.shouldSwingHand() && !client.player.isHolding(PORTALGUN)) { - client.player.swingHand(hand); - if (!itemStack.isEmpty() && (itemStack.getCount() != i || client.interactionManager.hasCreativeInventory())) { - client.gameRenderer.firstPersonRenderer.resetEquipProgress(hand); - } - } else if (client.player.isHolding(PORTALGUN)) - client.attackCooldown = 10; - - } - } - private static ActionResult myInteractBlock(Hand hand, ClientWorld targetWorld, BlockHitResult blockHitResult) { ClientWorld oldWorld = client.world; diff --git a/src/main/java/tk/meowmc/portalgun/misc/PortalMethods.java b/src/main/java/tk/meowmc/portalgun/misc/PortalMethods.java index 9c23605..9b839fa 100644 --- a/src/main/java/tk/meowmc/portalgun/misc/PortalMethods.java +++ b/src/main/java/tk/meowmc/portalgun/misc/PortalMethods.java @@ -4,6 +4,7 @@ import com.qouteall.immersive_portals.portal.GeometryPortalShape; import com.qouteall.immersive_portals.portal.Portal; import com.qouteall.immersive_portals.portal.PortalExtension; +import me.shedaniel.autoconfig.AutoConfig; import net.minecraft.block.Blocks; import net.minecraft.entity.LivingEntity; import net.minecraft.server.world.ServerWorld; @@ -14,6 +15,7 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; +import tk.meowmc.portalgun.config.PortalGunConfig; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -21,7 +23,7 @@ import static tk.meowmc.portalgun.items.PortalGunItem.*; public class PortalMethods { - public static final int TRIANGLE_NUM = 30; //Number of triangles used to approximate the elliptical shape of the portal + public static final int TRIANGLE_NUM = 30; //Number of triangles used to approximate the elliptical shape of the newPortal1 public static final double TAU = Math.PI*2; //mathematical name for 2 * PI public static final int PORTAL_HEIGHT = 2; public static final int PORTAL_WIDTH = 1; @@ -61,17 +63,20 @@ public static Vec3d calcPortalPos(BlockPos hit, Vec3i upright, Vec3i facing, Vec } - public static Portal Settings1(Direction direction, BlockPos blockPos, HitResult hit, LivingEntity user) { - Portal portal = Portal.entityType.create(McHelper.getServer().getWorld(user.world.getRegistryKey())); + public static void Settings1(Direction direction, BlockPos blockPos, HitResult hit, LivingEntity user) { + if (newPortal1 == null) + newPortal1 = Portal.entityType.create(McHelper.getServer().getWorld(user.world.getRegistryKey())); + PortalGunConfig config = AutoConfig.getConfigHolder(PortalGunConfig.class).getConfig(); Vec3d portalPosition = new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()); Vec3d destPos = new Vec3d(blockPos.getX(), blockPos.getY() + 2, blockPos.getZ()); - PortalExtension portalExtension = PortalExtension.get(portal); - - portal.setDestination(destPos); + if (newPortal1 != null) { + PortalExtension portalExtension = PortalExtension.get(newPortal1); + portalExtension.adjustPositionAfterTeleport = direction == Direction.UP || direction == Direction.DOWN; + } - portal.dimensionTo = newPortal2 != null ? newPortal2.world.getRegistryKey() : user.world.getRegistryKey(); + newPortal1.setDestination(destPos); - portalExtension.adjustPositionAfterTeleport = direction == Direction.UP || direction == Direction.DOWN; + newPortal1.dimensionTo = newPortal2 != null ? newPortal2.world.getRegistryKey() : user.world.getRegistryKey(); dirOut1 = ((BlockHitResult) hit).getSide().getOpposite().getVector(); @@ -81,32 +86,35 @@ public static Portal Settings1(Direction direction, BlockPos blockPos, HitResult dirRight1 = new Vec3i(-dirRight1.getX(), -dirRight1.getY(), -dirRight1.getZ()); - portal.setOriginPos(calcPortalPos(blockPos, dirUp1, dirOut1, dirRight1)); - portal.setOrientationAndSize( + newPortal1.setOriginPos(calcPortalPos(blockPos, dirUp1, dirOut1, dirRight1)); + newPortal1.setOrientationAndSize( Vec3d.of(dirRight1), //axisW Vec3d.of(dirUp1), //axisH PORTAL_WIDTH, // width PORTAL_HEIGHT // height ); - makeRoundPortal(portal); - portal.portalTag = "portalgun_portal1"; - return portal; + if (config.enabled.enableRoundPortals) + makeRoundPortal(newPortal1); + newPortal1.portalTag = "portalgun_portal1"; } - public static Portal Settings2(Direction direction, BlockPos blockPos, HitResult hit, LivingEntity user) { - Portal portal = Portal.entityType.create(McHelper.getServer().getWorld(user.world.getRegistryKey())); + public static void Settings2(Direction direction, BlockPos blockPos, HitResult hit, LivingEntity user) { + if (newPortal2 == null) + newPortal2 = Portal.entityType.create(McHelper.getServer().getWorld(user.world.getRegistryKey())); + PortalGunConfig config = AutoConfig.getConfigHolder(PortalGunConfig.class).getConfig(); Vec3d portalPosition = new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()); - PortalExtension portalExtension = PortalExtension.get(portal); + if (newPortal2 != null) { + PortalExtension portalExtension = PortalExtension.get(newPortal2); + portalExtension.adjustPositionAfterTeleport = direction == Direction.UP || direction == Direction.DOWN; + } - portal.dimensionTo = newPortal1 != null ? newPortal1.world.getRegistryKey() : user.world.getRegistryKey(); + newPortal2.dimensionTo = newPortal1 != null ? newPortal1.world.getRegistryKey() : user.world.getRegistryKey(); if (newPortal1 != null) - portal.setDestination(newPortal1.getPos()); + newPortal2.setDestination(newPortal1.getPos()); else - portal.setDestination(portalPosition); - portal.updatePosition(portalPosition.x, portalPosition.y, portalPosition.z); - - portalExtension.adjustPositionAfterTeleport = direction == Direction.UP || direction == Direction.DOWN; + newPortal2.setDestination(portalPosition); + newPortal2.updatePosition(portalPosition.x, portalPosition.y, portalPosition.z); dirOut2 = ((BlockHitResult) hit).getSide().getOpposite().getVector(); dirUp2 = dirOut2.getY() == 0 ? new Vec3i(0, 1, 0) : user.getHorizontalFacing().getVector(); @@ -115,16 +123,16 @@ public static Portal Settings2(Direction direction, BlockPos blockPos, HitResult dirRight2 = new Vec3i(-dirRight2.getX(), -dirRight2.getY(), -dirRight2.getZ()); - portal.setOriginPos(calcPortalPos(blockPos, dirUp2, dirOut2, dirRight2)); - portal.setOrientationAndSize( + newPortal2.setOriginPos(calcPortalPos(blockPos, dirUp2, dirOut2, dirRight2)); + newPortal2.setOrientationAndSize( Vec3d.of(dirRight2), //axisW Vec3d.of(dirUp2), //axisH PORTAL_WIDTH, // width PORTAL_HEIGHT // height ); - makeRoundPortal(portal); - portal.portalTag = "portalgun_portal2"; - return portal; + if (config.enabled.enableRoundPortals) + makeRoundPortal(newPortal2); + newPortal2.portalTag = "portalgun_portal2"; } public static void portal1Methods(LivingEntity user, HitResult hit, World world) { @@ -135,12 +143,14 @@ public static void portal1Methods(LivingEntity user, HitResult hit, World world) if (portalsTag.contains("Left" + "Portal")) { newPortal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); - if (newPortal1 != null) { - portal1Exists = true; + if (portal1 == null) { + newPortal1 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + portal1Exists = false; } + else + portal1Exists = true; } - - newPortal1 = Settings1(direction, blockPos, hit, user); + Settings1(direction, blockPos, hit, user); if (newPortal2 != null) newPortal1.setDestination(newPortal2.getPos()); @@ -152,11 +162,14 @@ public static void portal1Methods(LivingEntity user, HitResult hit, World world) if (portalsTag.contains("Right" + "Portal")) { newPortal2 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); - if (newPortal2 != null) { - portal2Exists = true; + if (newPortal2 == null) { + newPortal2 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + portal2Exists = false; } + else + portal2Exists = true; } - newPortal2 = Settings2(direction, blockPos, hit, user); + Settings2(direction, blockPos, hit, user); newPortal2.updatePosition(newPortal1.getDestPos().getX(), newPortal1.getDestPos().getY(), newPortal1.getDestPos().getZ()); newPortal2.setDestination(newPortal1.getPos()); @@ -171,18 +184,6 @@ public static void portal2Methods(LivingEntity user, HitResult hit, World world) BlockPos blockPos = blockHit.getBlockPos(); World portal1World = McHelper.getServerWorld(World.OVERWORLD); - if (portalsTag.contains("Left" + "Portal")) { - newPortal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); - if (newPortal1 != null) { - portal1Exists = true; - } - } - - newPortal1 = Settings1(direction, blockPos, hit, user); - - if (newPortal1 != null) - newPortal2.setDestination(newPortal1.getPos()); - if (newPortal1 != null) { portal1AxisW = newPortal1.axisW; portal1AxisH = newPortal1.axisH; @@ -190,11 +191,25 @@ public static void portal2Methods(LivingEntity user, HitResult hit, World world) if (portalsTag.contains("Right" + "Portal")) { newPortal2 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Right" + "Portal")); - if (newPortal2 != null) { + if (newPortal2 == null) { + newPortal2 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + portal2Exists = false; + } + else portal2Exists = true; + } + Settings2(direction, blockPos, hit, user); + + if (portalsTag.contains("Left" + "Portal")) { + newPortal1 = (Portal) ((ServerWorld) world).getEntity(portalsTag.getUuid("Left" + "Portal")); + if (portal1 == null) { + newPortal1 = Portal.entityType.create(McHelper.getServer().getWorld(world.getRegistryKey())); + portal1Exists = false; } + else + portal1Exists = true; } - newPortal2 = Settings2(direction, blockPos, hit, user); + Settings1(direction, blockPos, hit, user); if (space2BlockState.getBlock().is(Blocks.SNOW) && direction == Direction.UP) { newPortal2.updatePosition(newPortal2.getX(), newPortal2.getY() - 0.875, newPortal2.getZ()); diff --git a/src/main/java/tk/meowmc/portalgun/misc/RemoteCallables.java b/src/main/java/tk/meowmc/portalgun/misc/RemoteCallables.java index 4da5261..4854aa2 100644 --- a/src/main/java/tk/meowmc/portalgun/misc/RemoteCallables.java +++ b/src/main/java/tk/meowmc/portalgun/misc/RemoteCallables.java @@ -1,7 +1,6 @@ package tk.meowmc.portalgun.misc; import net.minecraft.client.MinecraftClient; -import net.minecraft.item.Item; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.sound.SoundCategory; import net.minecraft.world.World; @@ -33,6 +32,7 @@ public static void removeOldPortal1(ServerPlayerEntity user) { 1F); portalsTag.remove("Left" + "Portal"); waitPortal = false; + newPortal1 = null; } } } @@ -53,29 +53,19 @@ public static void removeOldPortal2(ServerPlayerEntity user) { 1F); portalsTag.remove("Right" + "Portal"); waitPortal = false; + newPortal2 = null; } } } public static void portal1Place(ServerPlayerEntity user) { - Item gunItem = PORTALGUN; + PortalGunItem gunItem = (PortalGunItem) PORTALGUN; boolean portalGunActive = user.isHolding(PORTALGUN); - if (delay && newPortal1 != null && portalGunActive) { - if (newPortal1.age >= 2 && newPortal1.isAlive()) { - ((PortalGunItem) gunItem).portal1Spawn(user.world, user, user.getActiveHand()); - client.attackCooldown = 10; - client.gameRenderer.firstPersonRenderer.resetEquipProgress(user.getActiveHand()); - } else if (!newPortal1.isAlive()) { - ((PortalGunItem) gunItem).portal1Spawn(user.world, user, user.getActiveHand()); - newPortal1.removed = false; - client.attackCooldown = 10; - client.gameRenderer.firstPersonRenderer.resetEquipProgress(user.getActiveHand()); + if(delay && newPortal1 != null && portalGunActive) { + gunItem.portal1Spawn(user.world, user, user.getActiveHand()); + if(!newPortal1.isAlive()) { + newPortal1.removed=false; } - - } else if (delay && newPortal1 == null && portalGunActive) { - ((PortalGunItem) gunItem).portal1Spawn(user.world, user, user.getActiveHand()); - client.attackCooldown = 10; - client.gameRenderer.firstPersonRenderer.resetEquipProgress(user.getActiveHand()); } } diff --git a/src/main/java/tk/meowmc/portalgun/mixin/CollisionHelperMixin.java b/src/main/java/tk/meowmc/portalgun/mixin/CollisionHelperMixin.java deleted file mode 100644 index 599c5a1..0000000 --- a/src/main/java/tk/meowmc/portalgun/mixin/CollisionHelperMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package tk.meowmc.portalgun.mixin; - -import com.qouteall.immersive_portals.teleportation.CollisionHelper; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.Vec3d; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -@Mixin(CollisionHelper.class) -public class CollisionHelperMixin { - /** - * @author someone - * @reason because I can - */ - @Overwrite(remap = false) - public static Box getStretchedBoundingBox(Entity entity) { - Vec3d expand = entity.getVelocity().multiply(1.2); - return entity.getBoundingBox().stretch(expand); - } -} diff --git a/src/main/java/tk/meowmc/portalgun/mixin/MinecraftClientMixin.java b/src/main/java/tk/meowmc/portalgun/mixin/MinecraftClientMixin.java index 156eb0f..df97b87 100644 --- a/src/main/java/tk/meowmc/portalgun/mixin/MinecraftClientMixin.java +++ b/src/main/java/tk/meowmc/portalgun/mixin/MinecraftClientMixin.java @@ -5,7 +5,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -31,9 +30,6 @@ public abstract class MinecraftClientMixin { @Shadow public int attackCooldown; - public MinecraftClientMixin() { - } - @Shadow protected abstract void doItemPick(); @@ -59,29 +55,11 @@ private void onHandleBlockBreaking(boolean isKeyPressed, CallbackInfo ci) { cancellable = true ) private void onDoAttack(CallbackInfo ci) { - if (this.attackCooldown <= 0 && MinecraftClientMethods.isPointingToPortal() && !player.isHolding(PORTALGUN)) { + if (this.attackCooldown <= 0 && MinecraftClientMethods.isPointingToPortal() && !player.isHolding(PORTALGUN)) MinecraftClientMethods.myAttackBlock(); - } else { - MinecraftClientMethods.doAttack(); - } + else MinecraftClientMethods.doAttack(); ci.cancel(); } - @Inject( - method = {"doItemUse"}, - at = {@At( - value = "INVOKE", - target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;" - )}, - cancellable = true - ) - private void onDoItemUse(CallbackInfo ci) { - if (MinecraftClientMethods.isPointingToPortal()) { - MinecraftClientMethods.myItemUse(Hand.MAIN_HAND); - ci.cancel(); - } - - } - } diff --git a/src/main/resources/assets/portalgun/animations/portalgun.animation.json b/src/main/resources/assets/portalgun/animations/portalgun.animation.json new file mode 100644 index 0000000..09ecebf --- /dev/null +++ b/src/main/resources/assets/portalgun/animations/portalgun.animation.json @@ -0,0 +1,70 @@ +{ + "format_version": "1.8.0", + "animations": { + "portal_shoot": { + "animation_length": 0.48, + "bones": { + "claw1": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.08": { + "vector": [22.5, 0, 0], + "easing": "easeOutCirc" + }, + "0.2": { + "vector": [0, 0, 0], + "easing": "easeInElastic" + } + } + }, + "claw2": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.08": { + "vector": [22.5, 0, 0], + "easing": "easeOutCirc" + }, + "0.2": { + "vector": [0, 0, 0], + "easing": "easeInElastic" + } + } + }, + "claw3": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.08": { + "vector": [22.5, 0, 0], + "easing": "easeOutCirc" + }, + "0.2": { + "vector": [0, 0, 0], + "easing": "easeInElastic" + } + } + }, + "everything": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.2": { + "vector": [11.5, 0, 0], + "easing": "easeInElastic" + }, + "0.36": { + "vector": [0, 0, 0], + "easing": "easeOutCubic" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/portalgun/geo/portalgun.geo.json b/src/main/resources/assets/portalgun/geo/portalgun.geo.json new file mode 100644 index 0000000..8457368 --- /dev/null +++ b/src/main/resources/assets/portalgun/geo/portalgun.geo.json @@ -0,0 +1,539 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.portal gun", + "texture_width": 32, + "texture_height": 32, + "visible_bounds_width": 2, + "visible_bounds_height": 2.5, + "visible_bounds_offset": [0, 0.75, 0] + }, + "bones": [ + { + "name": "everything", + "pivot": [-0.00333, 3.00667, -1.335], + "cubes": [ + { + "origin": [-1, 4, -1.7], + "size": [2, 2, 3], + "uv": { + "north": {"uv": [5, 16], "uv_size": [2, 2]}, + "east": {"uv": [8, 13], "uv_size": [3, 2]}, + "south": {"uv": [7, 16], "uv_size": [2, 2]}, + "west": {"uv": [13, 4], "uv_size": [3, 2]}, + "up": {"uv": [13, 6], "uv_size": [2, 3]}, + "down": {"uv": [14, 17], "uv_size": [2, -3]} + } + }, + { + "origin": [-1.2, 4, -1.7], + "size": [0.2, 1, 2.7], + "uv": { + "north": {"uv": [5, 8], "uv_size": [1, 1]}, + "east": {"uv": [8, 2], "uv_size": [3, 1]}, + "south": {"uv": [15, 17], "uv_size": [1, 1]}, + "west": {"uv": [15, 18], "uv_size": [3, 1]}, + "up": {"uv": [18, 18], "uv_size": [1, 3]}, + "down": {"uv": [18, 5], "uv_size": [1, -3]} + } + }, + { + "origin": [1, 4, -1.7], + "size": [0.3, 1, 2.7], + "uv": { + "north": {"uv": [23, 4], "uv_size": [1, 1]}, + "east": {"uv": [18, 5], "uv_size": [3, 1]}, + "south": {"uv": [23, 6], "uv_size": [1, 1]}, + "west": {"uv": [18, 6], "uv_size": [3, 1]}, + "up": {"uv": [18, 7], "uv_size": [1, 3]}, + "down": {"uv": [18, 17], "uv_size": [1, -3]} + } + }, + { + "origin": [-0.2, 4, -5.95], + "size": [0.4, 0.4, 0.4], + "uv": { + "north": {"uv": [23, 7], "uv_size": [1, 1]}, + "east": {"uv": [23, 9], "uv_size": [1, 1]}, + "south": {"uv": [23, 10], "uv_size": [1, 1]}, + "west": {"uv": [23, 11], "uv_size": [1, 1]}, + "up": {"uv": [23, 12], "uv_size": [1, 1]}, + "down": {"uv": [23, 14], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.2, 5.7, -5.95], + "size": [0.4, 0.4, 0.4], + "uv": { + "north": {"uv": [23, 15], "uv_size": [1, 1]}, + "east": {"uv": [23, 17], "uv_size": [1, 1]}, + "south": {"uv": [23, 18], "uv_size": [1, 1]}, + "west": {"uv": [23, 19], "uv_size": [1, 1]}, + "up": {"uv": [23, 20], "uv_size": [1, 1]}, + "down": {"uv": [23, 23], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.2, 4, -6.35], + "size": [0.4, 2.1, 0.4], + "uv": { + "north": {"uv": [20, 3], "uv_size": [1, 2]}, + "east": {"uv": [0, 21], "uv_size": [1, 2]}, + "south": {"uv": [1, 21], "uv_size": [1, 2]}, + "west": {"uv": [2, 21], "uv_size": [1, 2]}, + "up": {"uv": [3, 24], "uv_size": [1, 1]}, + "down": {"uv": [4, 25], "uv_size": [1, -1]} + } + }, + { + "origin": [-1.25, 3.75, 1], + "size": [2.5, 2.5, 1], + "uv": { + "north": {"uv": [0, 5], "uv_size": [3, 3]}, + "east": {"uv": [9, 19], "uv_size": [1, 3]}, + "south": {"uv": [5, 13], "uv_size": [3, 3]}, + "west": {"uv": [10, 19], "uv_size": [1, 3]}, + "up": {"uv": [18, 17], "uv_size": [3, 1]}, + "down": {"uv": [15, 20], "uv_size": [3, -1]} + } + }, + { + "origin": [-1.05, 5.85, 0.5], + "size": [2.1, 0.4, 0.5], + "pivot": [0.05, 6.25, 1], + "rotation": [27.5, 0, 0], + "uv": { + "north": {"uv": [20, 10], "uv_size": [2, 1]}, + "east": {"uv": [9, 24], "uv_size": [1, 1]}, + "south": {"uv": [20, 19], "uv_size": [2, 1]}, + "west": {"uv": [10, 24], "uv_size": [1, 1]}, + "up": {"uv": [3, 21], "uv_size": [2, 1]}, + "down": {"uv": [20, 22], "uv_size": [2, -1]} + } + }, + { + "origin": [-1.4, 3.8, -5.55], + "size": [2.6, 2.2, 3.65], + "uv": { + "north": {"uv": [14, 11], "uv_size": [3, 2]}, + "east": {"uv": [11, 9], "uv_size": [4, 2]}, + "south": {"uv": [0, 15], "uv_size": [3, 2]}, + "west": {"uv": [13, 0], "uv_size": [4, 2]}, + "up": {"uv": [0, 11], "uv_size": [3, 4]}, + "down": {"uv": [11, 15], "uv_size": [3, -4]} + } + } + ] + }, + { + "name": "head", + "parent": "everything", + "pivot": [-1.6, 5, 3.4], + "cubes": [ + { + "origin": [-0.85, 4.25, 3.65], + "size": [0.4, 1.6, 0.5], + "uv": { + "north": {"uv": [14, 21], "uv_size": [1, 2]}, + "east": {"uv": [18, 21], "uv_size": [1, 2]}, + "south": {"uv": [21, 0], "uv_size": [1, 2]}, + "west": {"uv": [21, 3], "uv_size": [1, 2]}, + "up": {"uv": [11, 24], "uv_size": [1, 1]}, + "down": {"uv": [12, 25], "uv_size": [1, -1]} + } + }, + { + "origin": [0.35, 6.25, 3.65], + "size": [0.4, 1.7, 0.5], + "pivot": [-0.4, 6.7, 3.4], + "rotation": [0, 0, 90], + "uv": { + "north": {"uv": [21, 5], "uv_size": [1, 2]}, + "east": {"uv": [21, 7], "uv_size": [1, 2]}, + "south": {"uv": [21, 11], "uv_size": [1, 2]}, + "west": {"uv": [21, 13], "uv_size": [1, 2]}, + "up": {"uv": [19, 24], "uv_size": [1, 1]}, + "down": {"uv": [20, 25], "uv_size": [1, -1]} + } + }, + { + "origin": [0.45, 4.25, 3.65], + "size": [0.4, 1.6, 0.5], + "uv": { + "north": {"uv": [3, 22], "uv_size": [1, 2]}, + "east": {"uv": [4, 22], "uv_size": [1, 2]}, + "south": {"uv": [9, 22], "uv_size": [1, 2]}, + "west": {"uv": [10, 22], "uv_size": [1, 2]}, + "up": {"uv": [21, 24], "uv_size": [1, 1]}, + "down": {"uv": [22, 25], "uv_size": [1, -1]} + } + }, + { + "origin": [-1.3, 2.95, 3.65], + "size": [0.4, 1.7, 0.5], + "pivot": [-0.3, 3.5, 3.4], + "rotation": [0, 0, 90], + "uv": { + "north": {"uv": [11, 22], "uv_size": [1, 2]}, + "east": {"uv": [12, 22], "uv_size": [1, 2]}, + "south": {"uv": [19, 22], "uv_size": [1, 2]}, + "west": {"uv": [20, 22], "uv_size": [1, 2]}, + "up": {"uv": [24, 24], "uv_size": [1, 1]}, + "down": {"uv": [24, 1], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.8, 4.1, -1.4], + "size": [1.6, 1.8, 5.3], + "uv": { + "north": {"uv": [9, 16], "uv_size": [2, 2]}, + "east": {"uv": [8, 0], "uv_size": [5, 2]}, + "south": {"uv": [11, 16], "uv_size": [2, 2]}, + "west": {"uv": [11, 2], "uv_size": [5, 2]}, + "up": {"uv": [3, 11], "uv_size": [2, 5]}, + "down": {"uv": [11, 9], "uv_size": [2, -5]} + } + }, + { + "origin": [-0.95, 4.1, 2.55], + "size": [1.9, 1.85, 0.9], + "uv": { + "north": {"uv": [16, 16], "uv_size": [2, 2]}, + "east": {"uv": [21, 22], "uv_size": [1, 2]}, + "south": {"uv": [16, 2], "uv_size": [2, 2]}, + "west": {"uv": [22, 22], "uv_size": [1, 2]}, + "up": {"uv": [21, 9], "uv_size": [2, 1]}, + "down": {"uv": [21, 16], "uv_size": [2, -1]} + } + }, + { + "origin": [-1.15, 3.85, 1.6], + "size": [2.3, 2.3, 0.7], + "uv": { + "north": {"uv": [16, 4], "uv_size": [2, 2]}, + "east": {"uv": [22, 0], "uv_size": [1, 2]}, + "south": {"uv": [16, 6], "uv_size": [2, 2]}, + "west": {"uv": [22, 3], "uv_size": [1, 2]}, + "up": {"uv": [21, 17], "uv_size": [2, 1]}, + "down": {"uv": [22, 6], "uv_size": [2, -1]} + } + } + ] + }, + { + "name": "claw1", + "parent": "everything", + "pivot": [0, 6.3, 1.5], + "cubes": [ + { + "origin": [-0.1, 6.95545, 4.74665], + "size": [0.2, 1.4, 0.2], + "pivot": [0, 8.2, 4.8], + "rotation": [54, 0, 0], + "uv": { + "north": {"uv": [24, 1], "uv_size": [1, 1]}, + "east": {"uv": [24, 2], "uv_size": [1, 1]}, + "south": {"uv": [24, 3], "uv_size": [1, 1]}, + "west": {"uv": [24, 4], "uv_size": [1, 1]}, + "up": {"uv": [24, 5], "uv_size": [1, 1]}, + "down": {"uv": [24, 7], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.1, 7.6, 1.6], + "size": [0.2, 3.5, 0.2], + "pivot": [0, 7.7, 1.7], + "rotation": [-80, 0, 0], + "uv": { + "north": {"uv": [11, 19], "uv_size": [1, 3]}, + "east": {"uv": [12, 19], "uv_size": [1, 3]}, + "south": {"uv": [19, 19], "uv_size": [1, 3]}, + "west": {"uv": [19, 2], "uv_size": [1, 3]}, + "up": {"uv": [24, 7], "uv_size": [1, 1]}, + "down": {"uv": [24, 9], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.1, 6.4, 1.4], + "size": [0.2, 1.6, 0.2], + "pivot": [0, 6.5, 1.5], + "rotation": [-15, 0, 0], + "uv": { + "north": {"uv": [22, 6], "uv_size": [1, 2]}, + "east": {"uv": [22, 10], "uv_size": [1, 2]}, + "south": {"uv": [22, 12], "uv_size": [1, 2]}, + "west": {"uv": [22, 18], "uv_size": [1, 2]}, + "up": {"uv": [24, 9], "uv_size": [1, 1]}, + "down": {"uv": [24, 11], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.4, 6, 1.1], + "size": [0.8, 0.4, 0.8], + "uv": { + "north": {"uv": [24, 11], "uv_size": [1, 1]}, + "east": {"uv": [24, 12], "uv_size": [1, 1]}, + "south": {"uv": [24, 13], "uv_size": [1, 1]}, + "west": {"uv": [24, 14], "uv_size": [1, 1]}, + "up": {"uv": [24, 15], "uv_size": [1, 1]}, + "down": {"uv": [24, 17], "uv_size": [1, -1]} + } + } + ] + }, + { + "name": "claw2", + "parent": "everything", + "pivot": [-0.4, 4.9, 3.7], + "rotation": [0, 0, -122.5], + "cubes": [ + { + "origin": [-0.5, 5.82431, 4.37412], + "size": [0.2, 1.4, 0.2], + "pivot": [-0.4, 7.9, 3.7], + "rotation": [54, 0, 0], + "uv": { + "north": {"uv": [24, 17], "uv_size": [1, 1]}, + "east": {"uv": [24, 18], "uv_size": [1, 1]}, + "south": {"uv": [24, 19], "uv_size": [1, 1]}, + "west": {"uv": [24, 20], "uv_size": [1, 1]}, + "up": {"uv": [24, 21], "uv_size": [1, 1]}, + "down": {"uv": [24, 23], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.5, 7.4, 1.6], + "size": [0.2, 3.5, 0.2], + "pivot": [-0.4, 7.5, 1.7], + "rotation": [-80, 0, 0], + "uv": { + "north": {"uv": [19, 7], "uv_size": [1, 3]}, + "east": {"uv": [19, 13], "uv_size": [1, 3]}, + "south": {"uv": [5, 20], "uv_size": [1, 3]}, + "west": {"uv": [6, 20], "uv_size": [1, 3]}, + "up": {"uv": [24, 23], "uv_size": [1, 1]}, + "down": {"uv": [0, 26], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.5, 6.2, 1.4], + "size": [0.2, 1.6, 0.2], + "pivot": [-0.4, 6.3, 1.5], + "rotation": [-15, 0, 0], + "uv": { + "north": {"uv": [0, 23], "uv_size": [1, 2]}, + "east": {"uv": [1, 23], "uv_size": [1, 2]}, + "south": {"uv": [2, 23], "uv_size": [1, 2]}, + "west": {"uv": [5, 23], "uv_size": [1, 2]}, + "up": {"uv": [1, 25], "uv_size": [1, 1]}, + "down": {"uv": [2, 26], "uv_size": [1, -1]} + } + }, + { + "origin": [-0.9, 5.7, 1.1], + "size": [0.8, 0.4, 0.8], + "pivot": [0.1, 5.8, 0], + "rotation": [0, 0, 32.5], + "uv": { + "north": {"uv": [3, 25], "uv_size": [1, 1]}, + "east": {"uv": [4, 25], "uv_size": [1, 1]}, + "south": {"uv": [5, 25], "uv_size": [1, 1]}, + "west": {"uv": [6, 25], "uv_size": [1, 1]}, + "up": {"uv": [7, 25], "uv_size": [1, 1]}, + "down": {"uv": [8, 26], "uv_size": [1, -1]} + } + } + ] + }, + { + "name": "claw3", + "parent": "everything", + "pivot": [0.4, 4.9, 3.7], + "rotation": [0, 0, 122.5], + "cubes": [ + { + "origin": [0.3, 5.82431, 4.37412], + "size": [0.2, 1.4, 0.2], + "pivot": [0.4, 7.9, 3.7], + "rotation": [54, 0, 0], + "uv": { + "north": {"uv": [9, 25], "uv_size": [1, 1]}, + "east": {"uv": [10, 25], "uv_size": [1, 1]}, + "south": {"uv": [11, 25], "uv_size": [1, 1]}, + "west": {"uv": [12, 25], "uv_size": [1, 1]}, + "up": {"uv": [13, 25], "uv_size": [1, 1]}, + "down": {"uv": [14, 26], "uv_size": [1, -1]} + } + }, + { + "origin": [0.3, 7.4, 1.6], + "size": [0.2, 3.5, 0.2], + "pivot": [0.4, 7.5, 1.7], + "rotation": [-80, 0, 0], + "uv": { + "north": {"uv": [7, 20], "uv_size": [1, 3]}, + "east": {"uv": [8, 20], "uv_size": [1, 3]}, + "south": {"uv": [13, 20], "uv_size": [1, 3]}, + "west": {"uv": [15, 20], "uv_size": [1, 3]}, + "up": {"uv": [15, 25], "uv_size": [1, 1]}, + "down": {"uv": [16, 26], "uv_size": [1, -1]} + } + }, + { + "origin": [0.3, 6.2, 1.4], + "size": [0.2, 1.6, 0.2], + "pivot": [0.4, 6.3, 1.5], + "rotation": [-15, 0, 0], + "uv": { + "north": {"uv": [6, 23], "uv_size": [1, 2]}, + "east": {"uv": [7, 23], "uv_size": [1, 2]}, + "south": {"uv": [8, 23], "uv_size": [1, 2]}, + "west": {"uv": [13, 23], "uv_size": [1, 2]}, + "up": {"uv": [17, 25], "uv_size": [1, 1]}, + "down": {"uv": [18, 26], "uv_size": [1, -1]} + } + }, + { + "origin": [0.3, 6.2, 1.1], + "size": [0.8, 0.4, 0.8], + "pivot": [0.9, 5.8, 0], + "rotation": [0, 0, -32.5], + "uv": { + "north": {"uv": [19, 25], "uv_size": [1, 1]}, + "east": {"uv": [20, 25], "uv_size": [1, 1]}, + "south": {"uv": [21, 25], "uv_size": [1, 1]}, + "west": {"uv": [22, 25], "uv_size": [1, 1]}, + "up": {"uv": [23, 25], "uv_size": [1, 1]}, + "down": {"uv": [24, 26], "uv_size": [1, -1]} + } + } + ] + }, + { + "name": "frontshell", + "parent": "everything", + "pivot": [0, 3.3, 0], + "cubes": [ + { + "origin": [-1.5, 5, 1], + "size": [0.2, 0.9, 1.9], + "uv": { + "north": {"uv": [14, 23], "uv_size": [1, 2]}, + "east": {"uv": [16, 8], "uv_size": [2, 1]}, + "south": {"uv": [15, 23], "uv_size": [1, 2]}, + "west": {"uv": [16, 14], "uv_size": [2, 2]}, + "up": {"uv": [16, 23], "uv_size": [1, 2]}, + "down": {"uv": [17, 25], "uv_size": [1, -2]} + } + }, + { + "origin": [-1.5, 3.8, -0.1], + "size": [0.2, 1.2, 3.9], + "uv": { + "north": {"uv": [25, 25], "uv_size": [1, 1]}, + "east": {"uv": [16, 10], "uv_size": [4, 1]}, + "south": {"uv": [25, 0], "uv_size": [1, 1]}, + "west": {"uv": [17, 0], "uv_size": [4, 1]}, + "up": {"uv": [0, 17], "uv_size": [1, 4]}, + "down": {"uv": [1, 21], "uv_size": [1, -4]} + } + }, + { + "origin": [1.3, 3.8, -0.1], + "size": [0.2, 1.2, 3.9], + "uv": { + "north": {"uv": [25, 1], "uv_size": [1, 1]}, + "east": {"uv": [17, 1], "uv_size": [4, 1]}, + "south": {"uv": [25, 2], "uv_size": [1, 1]}, + "west": {"uv": [17, 11], "uv_size": [4, 1]}, + "up": {"uv": [2, 17], "uv_size": [1, 4]}, + "down": {"uv": [14, 21], "uv_size": [1, -4]} + } + }, + { + "origin": [1.3, 5, 1], + "size": [0.2, 0.9, 1.9], + "uv": { + "north": {"uv": [18, 23], "uv_size": [1, 2]}, + "east": {"uv": [5, 18], "uv_size": [2, 2]}, + "south": {"uv": [23, 23], "uv_size": [1, 2]}, + "west": {"uv": [7, 18], "uv_size": [2, 1]}, + "up": {"uv": [23, 0], "uv_size": [1, 2]}, + "down": {"uv": [23, 4], "uv_size": [1, -2]} + } + }, + { + "origin": [-1.5, 3.6, 0], + "size": [3, 0.2, 3.8], + "uv": { + "north": {"uv": [19, 16], "uv_size": [3, 1]}, + "east": {"uv": [17, 12], "uv_size": [4, 1]}, + "south": {"uv": [19, 18], "uv_size": [3, 1]}, + "west": {"uv": [9, 18], "uv_size": [4, 1]}, + "up": {"uv": [5, 9], "uv_size": [3, 4]}, + "down": {"uv": [8, 13], "uv_size": [3, -4]} + } + }, + { + "origin": [-1.1, 3.6, 3.8], + "size": [2.2, 0.2, 0.7], + "uv": { + "north": {"uv": [22, 8], "uv_size": [2, 1]}, + "east": {"uv": [25, 3], "uv_size": [1, 1]}, + "south": {"uv": [22, 14], "uv_size": [2, 1]}, + "west": {"uv": [25, 4], "uv_size": [1, 1]}, + "up": {"uv": [22, 16], "uv_size": [2, 1]}, + "down": {"uv": [22, 22], "uv_size": [2, -1]} + } + } + ] + }, + { + "name": "backshell", + "parent": "everything", + "pivot": [0, 0, 1], + "cubes": [ + { + "origin": [-1.5, 6, -6.45], + "size": [3, 0.3, 4.95], + "uv": { + "north": {"uv": [20, 20], "uv_size": [3, 1]}, + "east": {"uv": [14, 13], "uv_size": [5, 1]}, + "south": {"uv": [20, 2], "uv_size": [3, 1]}, + "west": {"uv": [8, 15], "uv_size": [5, 1]}, + "up": {"uv": [0, 0], "uv_size": [3, 5]}, + "down": {"uv": [3, 8], "uv_size": [3, -5]} + } + }, + { + "origin": [-1.5, 3.6, -6.45], + "size": [0.3, 2.7, 4.95], + "uv": { + "north": {"uv": [16, 20], "uv_size": [1, 3]}, + "east": {"uv": [3, 0], "uv_size": [5, 3]}, + "south": {"uv": [17, 20], "uv_size": [1, 3]}, + "west": {"uv": [6, 6], "uv_size": [5, 3]}, + "up": {"uv": [13, 15], "uv_size": [1, 5]}, + "down": {"uv": [15, 11], "uv_size": [1, -5]} + } + }, + { + "origin": [1.2, 3.6, -6.45], + "size": [0.3, 2.7, 4.95], + "uv": { + "north": {"uv": [20, 7], "uv_size": [1, 3]}, + "east": {"uv": [6, 3], "uv_size": [5, 3]}, + "south": {"uv": [20, 13], "uv_size": [1, 3]}, + "west": {"uv": [0, 8], "uv_size": [5, 3]}, + "up": {"uv": [3, 16], "uv_size": [1, 5]}, + "down": {"uv": [4, 21], "uv_size": [1, -5]} + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/portalgun/models/item/portal_gun.json b/src/main/resources/assets/portalgun/models/item/portal_gun.json index ce4654f..bacc0a6 100644 --- a/src/main/resources/assets/portalgun/models/item/portal_gun.json +++ b/src/main/resources/assets/portalgun/models/item/portal_gun.json @@ -1,291 +1,139 @@ { - "credit": "Made with Blockbench", - "textures": { - "quartz_block_bottom": "portalgun:blocks/quartz_block_bottom", - "glass": "portalgun:blocks/glass", - "anvil_base": "portalgun:blocks/anvil_base", - "wool_colored_blue": "portalgun:blocks/wool_colored_blue" - }, - "elements": [ - { - "from": [1, 8, 4], - "to": [10, 11.5, 12], - "faces": { - "north": {"uv": [0, 12.5, 9, 16], "texture": "#quartz_block_bottom"}, - "east": {"uv": [0, 1, 8, 4.5], "texture": "#quartz_block_bottom"}, - "south": {"uv": [0, 0, 9, 3.5], "texture": "#quartz_block_bottom"}, - "west": {"uv": [8, 4, 16, 7.5], "texture": "#quartz_block_bottom"}, - "up": {"uv": [8, 7, 16, 16], "rotation": 270, "texture": "#anvil_base"}, - "down": {"uv": [8, 16, 0, 7], "rotation": 90, "texture": "#quartz_block_bottom"} - } - }, - { - "from": [1, 11.5, 8.5], - "to": [10, 12, 12], - "faces": { - "north": {"uv": [6, 4, 15, 4.5], "texture": "#quartz_block_bottom"}, - "east": {"uv": [4, 4, 7.5, 4.5], "texture": "#quartz_block_bottom"}, - "south": {"uv": [1, 4, 10, 4.5], "texture": "#quartz_block_bottom"}, - "west": {"uv": [8.5, 4, 12, 4.5], "texture": "#quartz_block_bottom"}, - "up": {"uv": [4, 1, 7.5, 10], "rotation": 270, "texture": "#quartz_block_bottom"}, - "down": {"uv": [12, 10, 8.5, 1], "rotation": 90, "texture": "#quartz_block_bottom"} - } - }, - { - "from": [1, 11.5, 4], - "to": [10, 12, 7.5], - "faces": { - "north": {"uv": [6, 4, 15, 4.5], "texture": "#quartz_block_bottom"}, - "east": {"uv": [8.5, 4, 12, 4.5], "texture": "#quartz_block_bottom"}, - "south": {"uv": [1, 4, 10, 4.5], "texture": "#quartz_block_bottom"}, - "west": {"uv": [4, 4, 7.5, 4.5], "texture": "#quartz_block_bottom"}, - "up": {"uv": [8.5, 1, 12, 10], "rotation": 270, "texture": "#quartz_block_bottom"}, - "down": {"uv": [7.5, 10, 4, 1], "rotation": 90, "texture": "#quartz_block_bottom"} - } - }, - { - "from": [1, 6, 4.5], - "to": [10, 8, 11.5], - "faces": { - "north": {"uv": [6, 8.5, 15, 9.5], "texture": "#anvil_base"}, - "east": {"uv": [4.5, 8.5, 11.5, 9.5], "texture": "#anvil_base"}, - "south": {"uv": [1, 8.5, 10, 9.5], "texture": "#anvil_base"}, - "west": {"uv": [4.5, 8.5, 11.5, 9.5], "texture": "#anvil_base"}, - "up": {"uv": [4.5, 1, 11.5, 10], "rotation": 270, "texture": "#anvil_base"}, - "down": {"uv": [11.5, 10, 4.5, 1], "rotation": 90, "texture": "#anvil_base"} - } - }, - { - "from": [10, 7, 6.5], - "to": [15.5, 10, 9.5], - "shade": false, - "faces": { - "north": {"uv": [0, 0, 5.5, 3], "texture": "#glass", "cullface": "north"}, - "east": {"uv": [0, 0, 4, 3], "texture": "#glass", "cullface": "east"}, - "south": {"uv": [10.5, 13, 16, 16], "texture": "#glass", "cullface": "south"}, - "west": {"uv": [0, 13, 4, 16], "texture": "#glass", "cullface": "west"}, - "up": {"uv": [12, 10.5, 16, 16], "rotation": 270, "texture": "#glass", "cullface": "up"}, - "down": {"uv": [4, 5.5, 0, 0], "rotation": 90, "texture": "#glass", "cullface": "down"} - } - }, - { - "from": [10, 6.5, 5], - "to": [15, 8.5, 11], - "faces": { - "north": {"uv": [0.5, 1, 5.5, 3], "texture": "#anvil_base"}, - "east": {"uv": [0.5, 13.5, 6.5, 15.5], "texture": "#anvil_base"}, - "south": {"uv": [10.5, 0.5, 15.5, 2.5], "texture": "#anvil_base"}, - "west": {"uv": [9.5, 0.5, 15.5, 2.5], "texture": "#anvil_base"}, - "up": {"uv": [4.5, 2.5, 10.5, 7.5], "rotation": 270, "texture": "#anvil_base"}, - "down": {"uv": [10, 5.5, 4, 0.5], "rotation": 90, "texture": "#anvil_base"} - } - }, - { - "from": [15, 6, 4.5], - "to": [19, 9, 11.5], - "faces": { - "north": {"uv": [1.5, 7, 13, 10], "texture": "#quartz_block_bottom", "cullface": "north"}, - "east": {"uv": [7, 2.5, 14, 5.5], "texture": "#quartz_block_bottom", "cullface": "east"}, - "south": {"uv": [4.5, 7, 14, 9.5], "texture": "#quartz_block_bottom", "cullface": "south"}, - "west": {"uv": [7.5, 4, 14.5, 7], "texture": "#quartz_block_bottom", "cullface": "west"}, - "up": {"uv": [5, 5, 12, 12], "rotation": 270, "texture": "#quartz_block_bottom", "cullface": "up"}, - "down": {"uv": [11.5, 5.5, 4.5, 12.5], "rotation": 90, "texture": "#quartz_block_bottom", "cullface": "down"} - } - }, - { - "from": [15.5, 9, 6], - "to": [18, 11, 10], - "faces": { - "north": {"uv": [2.5, 5, 10, 11.5], "texture": "#anvil_base", "cullface": "south"}, - "east": {"uv": [6, 5, 14.5, 13.5], "texture": "#anvil_base", "cullface": "south"}, - "south": {"uv": [4.5, 4, 12, 10.5], "texture": "#anvil_base", "cullface": "south"}, - "west": {"uv": [6, 5, 15, 13.5], "texture": "#anvil_base", "cullface": "south"}, - "up": {"uv": [4.5, 8, 11, 14], "rotation": 270, "texture": "#anvil_base", "cullface": "south"}, - "down": {"uv": [9.5, 6, 3, 13], "rotation": 90, "texture": "#anvil_base", "cullface": "south"} - } - }, - { - "from": [18, 7.5, 6.5], - "to": [20, 10.5, 9.5], - "faces": { - "north": {"uv": [3, 5.5, 10.5, 13], "texture": "#anvil_base", "cullface": "north"}, - "east": {"uv": [1.5, 1.5, 9, 10.5], "texture": "#anvil_base", "cullface": "east"}, - "south": {"uv": [5, 4.5, 11, 9.5], "texture": "#anvil_base", "cullface": "south"}, - "west": {"uv": [1, 5.5, 7, 12], "texture": "#anvil_base", "cullface": "west"}, - "up": {"uv": [5, 5.5, 13.5, 13.5], "rotation": 270, "texture": "#anvil_base", "cullface": "down"}, - "down": {"uv": [10.5, 4.5, 4.5, 12.5], "rotation": 90, "texture": "#anvil_base", "cullface": "up"} - } - }, - { - "from": [7.5, 11.5, 7.5], - "to": [8.5, 12, 8.5], - "shade": false, - "faces": { - "north": {"uv": [15, 0, 16, 0.5], "texture": "#wool_colored_blue"}, - "east": {"uv": [15, 0, 16, 0.5], "texture": "#wool_colored_blue"}, - "south": {"uv": [15, 0, 16, 0.5], "texture": "#wool_colored_blue"}, - "west": {"uv": [15, 0, 16, 0.5], "texture": "#wool_colored_blue"}, - "up": {"uv": [15, 0, 16, 1], "rotation": 270, "texture": "#wool_colored_blue"}, - "down": {"uv": [16, 1, 15, 0], "rotation": 90, "texture": "#wool_colored_blue"} - } - }, - { - "from": [18, 10, 7.4375], - "to": [19, 13.5, 8.4375], - "shade": false, - "rotation": {"angle": -45, "axis": "z", "origin": [18, 13.5, 7.4375]}, - "faces": { - "north": {"uv": [0, 1.5, 6, 10.5], "texture": "#anvil_base"}, - "east": {"uv": [5, 1, 11.5, 9], "texture": "#anvil_base"}, - "south": {"uv": [6.5, 1, 13, 10], "texture": "#anvil_base"}, - "west": {"uv": [5, 2.5, 12.5, 11.5], "texture": "#anvil_base"}, - "up": {"uv": [8.5, 6, 11.5, 14], "rotation": 180, "texture": "#anvil_base"}, - "down": {"uv": [9.5, 3, 14, 9], "rotation": 180, "texture": "#anvil_base"} - } - }, - { - "from": [18, 12.5, 7.5], - "to": [21, 13.5, 8.5], - "shade": false, - "faces": { - "north": {"uv": [9.5, 2.5, 15, 10], "texture": "#anvil_base"}, - "east": {"uv": [7.5, 2.5, 14.5, 10.5], "texture": "#anvil_base"}, - "south": {"uv": [8.5, 2.5, 15, 10], "texture": "#anvil_base"}, - "west": {"uv": [2.5, 3, 10, 11], "texture": "#anvil_base"}, - "up": {"uv": [1.5, 7.5, 9.5, 15.5], "rotation": 180, "texture": "#anvil_base"}, - "down": {"uv": [5.5, 3.5, 14.5, 9.5], "rotation": 180, "texture": "#anvil_base"} - } - }, - { - "from": [20, 10.5, 7.5], - "to": [21, 13, 8.5], - "rotation": {"angle": 22.5, "axis": "z", "origin": [20, 13, 7.5]}, - "faces": { - "north": {"uv": [3.5, 2.5, 12, 13], "texture": "#anvil_base"}, - "east": {"uv": [5, 2.5, 13, 11], "texture": "#anvil_base"}, - "south": {"uv": [4, 1.5, 14.5, 12], "texture": "#anvil_base"}, - "west": {"uv": [5.5, 2.5, 13, 12], "texture": "#anvil_base"}, - "up": {"uv": [6, 6, 12.5, 12.5], "rotation": 180, "texture": "#anvil_base"}, - "down": {"uv": [5.5, 5, 11.5, 11.5], "rotation": 180, "texture": "#anvil_base"} - } - }, - { - "from": [15.5, 6.5, 10.5], - "to": [20, 7.5, 11.5], - "rotation": {"angle": -22.5, "axis": "y", "origin": [15.5, 6.5, 10.5]}, - "faces": { - "north": {"uv": [6, 8.5, 12.5, 16], "texture": "#anvil_base"}, - "east": {"uv": [3, 8.5, 13, 16], "texture": "#anvil_base"}, - "south": {"uv": [7, 8.5, 15, 16], "texture": "#anvil_base"}, - "west": {"uv": [4, 8.5, 13, 16], "texture": "#anvil_base"}, - "up": {"uv": [5, 5, 11.5, 15], "texture": "#anvil_base"}, - "down": {"uv": [4, 6, 12, 13], "texture": "#anvil_base"} - } - }, - { - "from": [19, 6.5, 12], - "to": [21.5, 7.5, 13], - "faces": { - "north": {"uv": [4.5, 6, 14.5, 16], "texture": "#anvil_base"}, - "east": {"uv": [2.5, 4, 11.5, 14], "texture": "#anvil_base"}, - "south": {"uv": [4, 3, 15.5, 16], "texture": "#anvil_base"}, - "west": {"uv": [5.5, 6.5, 14, 16], "texture": "#anvil_base"}, - "up": {"uv": [5.5, 4.5, 14.5, 15.5], "texture": "#anvil_base"}, - "down": {"uv": [2.5, 5.5, 13, 14], "texture": "#anvil_base"} - } - }, - { - "from": [20.5, 6.5, 12.5], - "to": [22.5, 7.5, 13.5], - "rotation": {"angle": 45, "axis": "y", "origin": [20.5, 6.5, 12.5]}, - "faces": { - "north": {"uv": [6, 9, 8, 10], "texture": "#anvil_base"}, - "east": {"uv": [4.5, 7, 5.5, 8], "texture": "#anvil_base"}, - "south": {"uv": [6, 6, 8, 7], "texture": "#anvil_base"}, - "west": {"uv": [4.5, 9, 5.5, 10], "texture": "#anvil_base"}, - "up": {"uv": [2, 11.5, 4, 12.5], "texture": "#anvil_base"}, - "down": {"uv": [5, 12.5, 7, 11.5], "texture": "#anvil_base"} - } - }, - { - "from": [15, 6.5, 4.5], - "to": [19.5, 7.5, 5.5], - "rotation": {"angle": 22.5, "axis": "y", "origin": [15, 6.5, 4.5]}, - "faces": { - "north": {"uv": [3, 9, 12.5, 16], "texture": "#anvil_base"}, - "east": {"uv": [1, 3.5, 12.5, 15], "texture": "#anvil_base"}, - "south": {"uv": [2.5, 3.5, 11.5, 14], "texture": "#anvil_base"}, - "west": {"uv": [1, 2, 14, 14.5], "texture": "#anvil_base"}, - "up": {"uv": [5, 4, 12.5, 14], "texture": "#anvil_base"}, - "down": {"uv": [7, 7, 14, 11.5], "texture": "#anvil_base"} - } - }, - { - "from": [19, 6.5, 3], - "to": [21, 7.5, 4], - "faces": { - "north": {"uv": [5.5, 8.5, 13, 16], "texture": "#anvil_base"}, - "east": {"uv": [2.5, 6.5, 11, 15], "texture": "#anvil_base"}, - "south": {"uv": [7.5, 8.5, 14.5, 16], "texture": "#anvil_base"}, - "west": {"uv": [3, 8.5, 12, 16], "texture": "#anvil_base"}, - "up": {"uv": [7.5, 3, 15.5, 11.5], "texture": "#anvil_base"}, - "down": {"uv": [7, 4, 15.5, 12.5], "texture": "#anvil_base"} - } - }, - { - "from": [21, 6.5, 3], - "to": [23, 7.5, 4], - "rotation": {"angle": -45, "axis": "y", "origin": [21, 6.5, 3]}, - "faces": { - "north": {"uv": [3.5, 8.5, 10.5, 16], "texture": "#anvil_base"}, - "east": {"uv": [5.5, 2.5, 16, 10.5], "texture": "#anvil_base"}, - "south": {"uv": [7, 4, 13, 12], "texture": "#anvil_base"}, - "west": {"uv": [2.5, 4, 10.5, 14.5], "texture": "#anvil_base"}, - "up": {"uv": [5, 3, 13.5, 15.5], "texture": "#anvil_base"}, - "down": {"uv": [5.5, 4, 12, 11], "texture": "#anvil_base"} - } - } - ], - "gui_light": "front", - "display": { - "thirdperson_righthand": { - "rotation": [0, 90, 0], - "translation": [0, 0, -3], - "scale": [0.65, 0.65, 0.65] - }, - "thirdperson_lefthand": { - "rotation": [0, -90, 0], - "scale": [0.65, 0.65, 0.65] - }, - "firstperson_righthand": { - "rotation": [0, 90, 0], - "translation": [0, 0, 1.5] - }, - "firstperson_lefthand": { - "rotation": [0, -90, 0], - "translation": [0, 0, 1.5] - }, - "ground": { - "rotation": [0, -90, 0] - }, - "gui": { - "rotation": [28, -140.75, 0], - "translation": [1.75, -1, 0], - "scale": [0.70273, 0.70273, 0.70273] - }, - "head": { - "rotation": [0, 90, 0] - }, - "fixed": { - "translation": [-3, 0, 0], - "scale": [0.9, 0.9, 0.9] - } - }, - "groups": [ - { - "name": "portalgun", - "origin": [8, 8, 8], - "children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18] - } - ] -} + "texture_size": [ + 32, + 32 + ], + "display": { + "thirdperson_righthand": { + "rotation": [ + 0, + -180, + 0 + ], + "translation": [ + 0, + -9, + -7.5 + ], + "scale": [ + 1.5, + 1.5, + 1.5 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + -180, + 0 + ], + "translation": [ + 0, + -9, + -7.5 + ], + "scale": [ + -1.5, + 1.5, + 1.5 + ] + }, + "firstperson_righthand": { + "rotation": [ + 0, + -180, + 0 + ], + "translation": [ + -1.5, + -4.5, + -0.25 + ], + "scale": [ + 1.25, + 1.25, + 1.25 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + -180, + 0 + ], + "translation": [ + -1.5, + -4.5, + -0.25 + ], + "scale": [ + -1.25, + 1.25, + 1.25 + ] + }, + "ground": { + "translation": [ + 0, + -4.25, + 1.75 + ], + "scale": [ + 1.25, + 1.25, + 1.25 + ] + }, + "gui": { + "rotation": [ + 28, + -40, + 0 + ], + "translation": [ + -0.5, + -4.5, + 0 + ], + "scale": [ + 1.25, + 1.25, + 1.25 + ] + }, + "head": { + "rotation": [ + 0, + -180, + 0 + ], + "translation": [ + 0, + -6.75, + -8.25 + ], + "scale": [ + 1.25, + 1.25, + 1.25 + ] + }, + "fixed": { + "rotation": [ + 0, + 90, + 0 + ], + "translation": [ + 0.5, + -5.75, + 0 + ], + "scale": [ + 1.25, + 1.25, + 1.25 + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/portalgun/textures/item/portal_gun.png b/src/main/resources/assets/portalgun/textures/item/portal_gun.png new file mode 100644 index 0000000..507e884 Binary files /dev/null and b/src/main/resources/assets/portalgun/textures/item/portal_gun.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a5bea36..5c8e43e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -17,6 +17,9 @@ ], "main": [ "tk.meowmc.portalgun.Portalgun" + ], + "modmenu": [ + "tk.meowmc.portalgun.config.ModMenuIntegration" ] }, "mixins": [ diff --git a/src/main/resources/portalgun.mixins.json b/src/main/resources/portalgun.mixins.json index 5d2b964..76851c6 100644 --- a/src/main/resources/portalgun.mixins.json +++ b/src/main/resources/portalgun.mixins.json @@ -3,14 +3,14 @@ "minVersion": "0.8", "package": "tk.meowmc.portalgun.mixin", "compatibilityLevel": "JAVA_8", + "target": "@env(", "mixins": [ - "CollisionHelperMixin", "PortalMixin", "ServerTeleportationManagerMixin" ], "client": [ - "MinecraftClientMixin", - "ClientPlayNetworkHandlerMixin" + "ClientPlayNetworkHandlerMixin", + "MinecraftClientMixin" ], "injectors": { "defaultRequire": 1