Start 1.14 update
This commit is contained in:
parent
65d3f58eaa
commit
b34e09a387
68
build.gradle
68
build.gradle
|
|
@ -8,16 +8,10 @@ buildscript {
|
|||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
maven { url = "https://minecraft.curseforge.com/api/maven/" }
|
||||
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.0'
|
||||
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
@ -26,11 +20,15 @@ archivesBaseName = 'modid'
|
|||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
||||
minecraft {
|
||||
|
||||
mappings channel: 'snapshot', version: '20180921-1.13'
|
||||
// The mappings can be changed at any time, and must be in the following format.
|
||||
// snapshot_YYYYMMDD Snapshot are built nightly.
|
||||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'snapshot', version: '20190719-1.14.3'
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
// accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg')
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
|
|
@ -66,14 +64,32 @@ minecraft {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
dependencies {
|
||||
|
||||
minecraft 'net.minecraftforge:forge:1.13.2-25.0.85'
|
||||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft 'net.minecraftforge:forge:1.14.4-28.0.14'
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
|
|
@ -83,8 +99,6 @@ dependencies {
|
|||
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
||||
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
||||
|
||||
// compile "obfuscate:Obfuscate:0.3.0"
|
||||
|
||||
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
|
|
@ -110,4 +124,26 @@ jar {
|
|||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish task
|
||||
// we define a custom artifact that is sourced from the reobfJar output task
|
||||
// and then declare that to be published
|
||||
// Note you'll need to add a repository here
|
||||
def reobfFile = file("$buildDir/reobfJar/output.jar")
|
||||
def reobfArtifact = artifacts.add('default', reobfFile) {
|
||||
type 'jar'
|
||||
builtBy 'reobfJar'
|
||||
}
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact reobfArtifact
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file:///${project.projectDir}/mcmodsrepo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,22 @@
|
|||
package tschipp.carryon.client.event;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
|
@ -24,7 +26,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|||
import net.minecraftforge.fml.ModList;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.helper.ScriptParseHelper;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemCarryonEntity;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
|
||||
|
|
@ -39,18 +41,18 @@ public class RenderEntityEvents
|
|||
public void renderHand(RenderHandEvent event)
|
||||
{
|
||||
World world = Minecraft.getInstance().world;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
int perspective = Minecraft.getInstance().gameSettings.thirdPersonView;
|
||||
float partialticks = event.getPartialTicks();
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
if(ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr"))
|
||||
return;
|
||||
|
||||
|
||||
Entity entity = ItemEntity.getEntity(stack, world);
|
||||
Entity entity = ItemCarryonEntity.getEntity(stack, world);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
|
|
@ -63,8 +65,8 @@ public class RenderEntityEvents
|
|||
entity.prevRotationYaw = 0.0f;
|
||||
entity.setRotationYawHead(0.0f);
|
||||
|
||||
float height = entity.height;
|
||||
float width = entity.width;
|
||||
float height = entity.getHeight();
|
||||
float width = entity.getWidth();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scaled(.8, .8, .8);
|
||||
GlStateManager.rotatef(180, 0, 1, 0);
|
||||
|
|
@ -85,10 +87,15 @@ public class RenderEntityEvents
|
|||
String entityname = carryOverride.getRenderNameEntity();
|
||||
if (entityname != null)
|
||||
{
|
||||
Entity newEntity = EntityType.create(world, new ResourceLocation(entityname));
|
||||
Entity newEntity = null;
|
||||
|
||||
Optional<EntityType<?>> type = EntityType.byKey(entityname);
|
||||
if(type.isPresent())
|
||||
newEntity = type.get().create(world);
|
||||
|
||||
if (newEntity != null)
|
||||
{
|
||||
NBTTagCompound nbttag = carryOverride.getRenderNBT();
|
||||
CompoundNBT nbttag = carryOverride.getRenderNBT();
|
||||
if (nbttag != null)
|
||||
newEntity.deserializeNBT(nbttag);
|
||||
entity = newEntity;
|
||||
|
|
@ -107,8 +114,8 @@ public class RenderEntityEvents
|
|||
|
||||
}
|
||||
|
||||
if(entity instanceof EntityLiving)
|
||||
((EntityLiving) entity).hurtTime = 0;
|
||||
if(entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).hurtTime = 0;
|
||||
|
||||
this.renderEntityStatic(entity);
|
||||
Minecraft.getInstance().getRenderManager().setRenderShadow(true);
|
||||
|
|
@ -120,9 +127,9 @@ public class RenderEntityEvents
|
|||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE1);
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE0);
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE1);
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE0);
|
||||
|
||||
if (perspective == 0)
|
||||
{
|
||||
|
|
@ -152,7 +159,7 @@ public class RenderEntityEvents
|
|||
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, j, k);
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, j, k);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
|
|
@ -164,8 +171,9 @@ public class RenderEntityEvents
|
|||
this.setLightmapDisabled(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private int getBrightnessForRender(Entity entity, EntityPlayer player)
|
||||
private int getBrightnessForRender(Entity entity, PlayerEntity player)
|
||||
{
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(player.posX), 0, MathHelper.floor(player.posZ));
|
||||
|
||||
|
|
@ -183,18 +191,18 @@ public class RenderEntityEvents
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
private void setLightmapDisabled(boolean disabled)
|
||||
{
|
||||
GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE1);
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE1);
|
||||
|
||||
if (disabled)
|
||||
{
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.disableTexture();
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.enableTexture();
|
||||
}
|
||||
|
||||
GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE0);
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -205,18 +213,17 @@ public class RenderEntityEvents
|
|||
public void onPlayerRenderPost(RenderPlayerEvent.Post event)
|
||||
{
|
||||
World world = Minecraft.getInstance().world;
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
event.getRenderer().getMainModel();
|
||||
EntityPlayerSP clientPlayer = Minecraft.getInstance().player;
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
Entity entity = ItemEntity.getEntity(stack, world);
|
||||
Entity entity = ItemCarryonEntity.getEntity(stack, world);
|
||||
float rotation = 0;
|
||||
|
||||
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof EntityLivingBase)
|
||||
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof LivingEntity)
|
||||
rotation = -(player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialticks);
|
||||
else
|
||||
rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
||||
|
|
@ -231,19 +238,21 @@ public class RenderEntityEvents
|
|||
double c1 = clientPlayer.lastTickPosY + (clientPlayer.posY - clientPlayer.lastTickPosY) * partialticks;
|
||||
double c2 = clientPlayer.lastTickPosZ + (clientPlayer.posZ - clientPlayer.lastTickPosZ) * partialticks;
|
||||
|
||||
double xOffset = d0 - c0;
|
||||
double yOffset = d1 - c1;
|
||||
double zOffset = d2 - c2;
|
||||
Vec3d cameraPos = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||
|
||||
double xOffset = d0 - cameraPos.getX();
|
||||
double yOffset = d1 - cameraPos.getY();
|
||||
double zOffset = d2 - cameraPos.getZ();
|
||||
|
||||
float height = entity.height;
|
||||
float width = entity.width;
|
||||
float height = entity.getHeight();
|
||||
float width = entity.getWidth();
|
||||
float multiplier = height * width;
|
||||
|
||||
entity.setPosition(c0, c1, c2);
|
||||
entity.rotationYaw = 0.0f;
|
||||
entity.prevRotationYaw = 0.0f;
|
||||
entity.setRotationYawHead(0.0f);
|
||||
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(xOffset, yOffset, zOffset);
|
||||
GlStateManager.scaled((10 - multiplier) * 0.08, (10 - multiplier) * 0.08, (10 - multiplier) * 0.08);
|
||||
|
|
@ -269,10 +278,15 @@ public class RenderEntityEvents
|
|||
String entityname = carryOverride.getRenderNameEntity();
|
||||
if (entityname != null)
|
||||
{
|
||||
Entity newEntity = EntityType.create(world, new ResourceLocation(entityname));
|
||||
Entity newEntity = null;
|
||||
|
||||
Optional<EntityType<?>> type = EntityType.byKey(entityname);
|
||||
if(type.isPresent())
|
||||
newEntity = type.get().create(world);
|
||||
|
||||
if (newEntity != null)
|
||||
{
|
||||
NBTTagCompound nbttag = carryOverride.getRenderNBT();
|
||||
CompoundNBT nbttag = carryOverride.getRenderNBT();
|
||||
if (nbttag != null)
|
||||
newEntity.deserializeNBT(nbttag);
|
||||
entity = newEntity;
|
||||
|
|
@ -291,10 +305,10 @@ public class RenderEntityEvents
|
|||
|
||||
}
|
||||
|
||||
if(entity instanceof EntityLiving)
|
||||
((EntityLiving) entity).hurtTime = 0;
|
||||
if(entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).hurtTime = 0;
|
||||
|
||||
Minecraft.getInstance().getRenderManager().renderEntityStatic(entity, 0.0f, false);
|
||||
renderEntityStatic(entity);
|
||||
Minecraft.getInstance().getRenderManager().setRenderShadow(true);
|
||||
|
||||
GlStateManager.scaled(1, 1, 1);
|
||||
|
|
|
|||
|
|
@ -2,32 +2,34 @@ package tschipp.carryon.client.event;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.GameSettings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.PlayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.ClickEvent.Action;
|
||||
|
|
@ -53,8 +55,8 @@ import tschipp.carryon.common.helper.KeyboardCallbackWrapper.KeyPressedEvent;
|
|||
import tschipp.carryon.common.helper.ScriptParseHelper;
|
||||
import tschipp.carryon.common.helper.ScrollCallbackWrapper.MouseScrolledEvent;
|
||||
import tschipp.carryon.common.helper.StringParser;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
import tschipp.carryon.common.item.ItemCarryonEntity;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
import tschipp.carryon.network.server.SyncKeybindPacket;
|
||||
|
|
@ -68,7 +70,7 @@ public class RenderEvents
|
|||
@SubscribeEvent
|
||||
public void onScroll(MouseScrolledEvent event)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
|
|
@ -76,7 +78,7 @@ public class RenderEvents
|
|||
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
{
|
||||
if (ItemTile.hasTileData(stack) || ItemEntity.hasEntityData(stack))
|
||||
if (ItemCarryonBlock.hasTileData(stack) || ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
|
@ -89,7 +91,7 @@ public class RenderEvents
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public void onPlayerTick(PlayerTickEvent event) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
|
||||
{
|
||||
EntityPlayer player = event.player;
|
||||
PlayerEntity player = event.player;
|
||||
|
||||
if (player != null && event.side == LogicalSide.CLIENT)
|
||||
{
|
||||
|
|
@ -112,9 +114,9 @@ public class RenderEvents
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public void onJoinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof EntityPlayer)
|
||||
if (event.getEntity() instanceof PlayerEntity)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.getEntity();
|
||||
PlayerEntity player = (PlayerEntity) event.getEntity();
|
||||
if (player.world.isRemote)
|
||||
{
|
||||
CarryOnKeybinds.setKeyPressed(player, false);
|
||||
|
|
@ -122,10 +124,10 @@ public class RenderEvents
|
|||
|
||||
if (CarryOn.FINGERPRINT_VIOLATED)
|
||||
{
|
||||
TextComponentString cf = new TextComponentString(TextFormatting.AQUA + "Curseforge" + TextFormatting.RED);
|
||||
StringTextComponent cf = new StringTextComponent(TextFormatting.AQUA + "Curseforge" + TextFormatting.RED);
|
||||
cf.getStyle().setClickEvent(new ClickEvent(Action.OPEN_URL, "https://minecraft.curseforge.com/projects/carry-on"));
|
||||
|
||||
player.sendMessage(new TextComponentString(TextFormatting.RED + "[CarryOn] WARNING! Invalid fingerprint detected! The Carry On mod file may have been tampered with! If you didn't download the file from ").appendSibling(cf).appendText(TextFormatting.RED + " or through any kind of mod launcher, immediately delete the file and re-download it from ").appendSibling(cf));
|
||||
player.sendMessage(new StringTextComponent(TextFormatting.RED + "[CarryOn] WARNING! Invalid fingerprint detected! The Carry On mod file may have been tampered with! If you didn't download the file from ").appendSibling(cf).appendText(TextFormatting.RED + " or through any kind of mod launcher, immediately delete the file and re-download it from ").appendSibling(cf));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,14 +143,14 @@ public class RenderEvents
|
|||
{
|
||||
if (event.getGui() != null)
|
||||
{
|
||||
boolean inventory = event.getGui() instanceof GuiContainer;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
boolean inventory = event.getGui() instanceof ContainerScreen;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
|
||||
if (player != null && inventory)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
ItemStack stack = player.getHeldItem(Hand.MAIN_HAND);
|
||||
|
||||
if (!stack.isEmpty() && ((stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))))
|
||||
if (!stack.isEmpty() && ((stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))))
|
||||
{
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
Minecraft.getInstance().currentScreen = null;
|
||||
|
|
@ -170,13 +172,13 @@ public class RenderEvents
|
|||
GameSettings settings = Minecraft.getInstance().gameSettings;
|
||||
int key = event.key;
|
||||
int scancode = event.scancode;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
ItemStack stack = Minecraft.getInstance().player.getHeldItemMainhand();
|
||||
|
||||
if (!stack.isEmpty() && ((stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))))
|
||||
if (!stack.isEmpty() && ((stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))))
|
||||
{
|
||||
if (settings.keyBindDrop.matchesKey(key, scancode))
|
||||
{
|
||||
|
|
@ -201,7 +203,7 @@ public class RenderEvents
|
|||
|
||||
int current = player.inventory.currentItem;
|
||||
|
||||
if (player.getEntityData().hasKey("carrySlot") ? player.getEntityData().getInt("carrySlot") != current : false)
|
||||
if (player.getEntityData().contains("carrySlot") ? player.getEntityData().getInt("carrySlot") != current : false)
|
||||
{
|
||||
player.inventory.currentItem = player.getEntityData().getInt("carrySlot");
|
||||
}
|
||||
|
|
@ -216,20 +218,20 @@ public class RenderEvents
|
|||
public void renderHand(RenderHandEvent event)
|
||||
{
|
||||
World world = Minecraft.getInstance().world;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
int perspective = Minecraft.getInstance().gameSettings.thirdPersonView;
|
||||
boolean f1 = Minecraft.getInstance().gameSettings.hideGUI;
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) && perspective == 0 && !f1)
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) && perspective == 0 && !f1)
|
||||
{
|
||||
if (ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr"))
|
||||
return;
|
||||
|
||||
Block block = ItemTile.getBlock(stack);
|
||||
NBTTagCompound tag = ItemTile.getTileData(stack);
|
||||
IBlockState state = ItemTile.getBlockState(stack);
|
||||
ItemStack tileStack = ItemTile.getItemStack(stack);
|
||||
Block block = ItemCarryonBlock.getBlock(stack);
|
||||
CompoundNBT tag = ItemCarryonBlock.getTileData(stack);
|
||||
BlockState state = ItemCarryonBlock.getBlockState(stack);
|
||||
ItemStack tileStack = ItemCarryonBlock.getItemStack(stack);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scaled(2.5, 2.5, 2.5);
|
||||
|
|
@ -272,11 +274,11 @@ public class RenderEvents
|
|||
int i = this.getBrightnessForRender(Minecraft.getInstance().player);
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, j, k);
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, j, k);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setLightmapDisabled(false);
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(state, tag))
|
||||
{
|
||||
|
|
@ -309,8 +311,9 @@ public class RenderEvents
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private int getBrightnessForRender(EntityPlayer player)
|
||||
private int getBrightnessForRender(PlayerEntity player)
|
||||
{
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(player.posX), 0, MathHelper.floor(player.posZ));
|
||||
|
||||
|
|
@ -327,17 +330,17 @@ public class RenderEvents
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
private void setLightmapDisabled(boolean disabled)
|
||||
{
|
||||
GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE1);
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE1);
|
||||
|
||||
if (disabled)
|
||||
{
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.disableTexture();;
|
||||
} else
|
||||
{
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.enableTexture();
|
||||
}
|
||||
|
||||
GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE0);
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -348,21 +351,21 @@ public class RenderEvents
|
|||
public void onPlayerRenderPost(RenderPlayerEvent.Post event)
|
||||
{
|
||||
World world = Minecraft.getInstance().world;
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
EntityPlayerSP clientPlayer = Minecraft.getInstance().player;
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
Block block = ItemTile.getBlock(stack);
|
||||
IBlockState state = ItemTile.getBlockState(stack);
|
||||
NBTTagCompound tag = ItemTile.getTileData(stack);
|
||||
ItemStack tileItem = ItemTile.getItemStack(stack);
|
||||
Block block = ItemCarryonBlock.getBlock(stack);
|
||||
BlockState state = ItemCarryonBlock.getBlockState(stack);
|
||||
CompoundNBT tag = ItemCarryonBlock.getTileData(stack);
|
||||
ItemStack tileItem = ItemCarryonBlock.getItemStack(stack);
|
||||
|
||||
float rotation = 0f;
|
||||
|
||||
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof EntityLivingBase)
|
||||
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof LivingEntity)
|
||||
rotation = -(player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialticks);
|
||||
else
|
||||
rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
||||
|
|
@ -427,7 +430,7 @@ public class RenderEvents
|
|||
|
||||
}
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(state, tag))
|
||||
{
|
||||
|
|
@ -463,22 +466,22 @@ public class RenderEvents
|
|||
|
||||
if (handleMobends() && !ModList.get().isLoaded("obfuscate"))
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
EntityPlayerSP clientPlayer = Minecraft.getInstance().player;
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
ModelPlayer model = event.getRenderer().getMainModel();
|
||||
PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel();
|
||||
float rotation = 0;
|
||||
|
||||
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof EntityLivingBase)
|
||||
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof LivingEntity)
|
||||
rotation = (player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialticks);
|
||||
else
|
||||
rotation = (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
||||
|
||||
AbstractClientPlayer aplayer = (AbstractClientPlayer) player;
|
||||
AbstractClientPlayerEntity aplayer = (AbstractClientPlayerEntity) player;
|
||||
ResourceLocation skinLoc = aplayer.getLocationSkin();
|
||||
|
||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialticks;
|
||||
|
|
@ -489,9 +492,11 @@ public class RenderEvents
|
|||
double c1 = clientPlayer.lastTickPosY + (clientPlayer.posY - clientPlayer.lastTickPosY) * partialticks;
|
||||
double c2 = clientPlayer.lastTickPosZ + (clientPlayer.posZ - clientPlayer.lastTickPosZ) * partialticks;
|
||||
|
||||
double xOffset = d0 - c0;
|
||||
double yOffset = d1 - c1;
|
||||
double zOffset = d2 - c2;
|
||||
Vec3d cameraPos = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||
|
||||
double xOffset = d0 - cameraPos.getX();
|
||||
double yOffset = d1 - cameraPos.getY();
|
||||
double zOffset = d2 - cameraPos.getZ();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(xOffset, yOffset, zOffset);
|
||||
|
|
@ -555,11 +560,11 @@ public class RenderEvents
|
|||
|
||||
if (handleMobends() && !ModList.get().isLoaded("obfuscate"))
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
ModelPlayer model = event.getRenderer().getMainModel();
|
||||
PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel();
|
||||
|
||||
CarryOnOverride overrider = ScriptChecker.getOverride(player);
|
||||
if (overrider != null)
|
||||
|
|
@ -591,7 +596,7 @@ public class RenderEvents
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderArmPost(ModelRenderer arm, float x, float z, float rotation, boolean right, boolean sneaking)
|
||||
public void renderArmPost(RendererModel arm, float x, float z, float rotation, boolean right, boolean sneaking)
|
||||
{
|
||||
arm.isHidden = false;
|
||||
if (right)
|
||||
|
|
@ -617,7 +622,7 @@ public class RenderEvents
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderArmPre(ModelRenderer arm)
|
||||
public void renderArmPre(RendererModel arm)
|
||||
{
|
||||
arm.isHidden = true;
|
||||
}
|
||||
|
|
@ -644,17 +649,17 @@ public class RenderEvents
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static RenderPlayer getRenderPlayer(AbstractClientPlayer player)
|
||||
private static PlayerRenderer getRenderPlayer(AbstractClientPlayerEntity player)
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
RenderManager manager = mc.getRenderManager();
|
||||
EntityRendererManager manager = mc.getRenderManager();
|
||||
return manager.getSkinMap().get(player.getSkinType());
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static ModelPlayer getPlayerModel(AbstractClientPlayer player)
|
||||
private static PlayerModel<AbstractClientPlayerEntity> getPlayerModel(AbstractClientPlayerEntity player)
|
||||
{
|
||||
return getRenderPlayer(player).getMainModel();
|
||||
return getRenderPlayer(player).getEntityModel();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package tschipp.carryon.client.keybinds;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
|
|
@ -21,20 +21,20 @@ public class CarryOnKeybinds
|
|||
ClientRegistry.registerKeyBinding(carryKey);
|
||||
}
|
||||
|
||||
public static boolean isKeyPressed(EntityPlayer player)
|
||||
public static boolean isKeyPressed(PlayerEntity player)
|
||||
{
|
||||
NBTTagCompound tag = player.getEntityData();
|
||||
if(tag != null && tag.hasKey(KEYBIND_KEY))
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
if(tag != null && tag.contains(KEYBIND_KEY))
|
||||
{
|
||||
return tag.getBoolean(KEYBIND_KEY);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void setKeyPressed(EntityPlayer player, boolean pressed)
|
||||
public static void setKeyPressed(PlayerEntity player, boolean pressed)
|
||||
{
|
||||
NBTTagCompound tag = player.getEntityData();
|
||||
tag.setBoolean(KEYBIND_KEY, pressed);
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
tag.putBoolean(KEYBIND_KEY, pressed);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package tschipp.carryon.common.capabilities;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
public class PositionProvider implements ICapabilitySerializable<NBTTagCompound> {
|
||||
public class PositionProvider implements ICapabilitySerializable<CompoundNBT> {
|
||||
|
||||
@CapabilityInject(IPosition.class)
|
||||
public static final Capability<IPosition> POSITION_CAPABILITY = null;
|
||||
|
|
@ -16,19 +16,19 @@ public class PositionProvider implements ICapabilitySerializable<NBTTagCompound>
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, EnumFacing side)
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
|
||||
{
|
||||
return (LazyOptional<T>) LazyOptional.of(() -> {return new TEPosition();});
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT()
|
||||
public CompoundNBT serializeNBT()
|
||||
{
|
||||
return (NBTTagCompound) POSITION_CAPABILITY.getStorage().writeNBT(POSITION_CAPABILITY, instance, null);
|
||||
return (CompoundNBT) POSITION_CAPABILITY.getStorage().writeNBT(POSITION_CAPABILITY, instance, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(NBTTagCompound nbt)
|
||||
public void deserializeNBT(CompoundNBT nbt)
|
||||
{
|
||||
POSITION_CAPABILITY.getStorage().readNBT(POSITION_CAPABILITY, instance, null, nbt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package tschipp.carryon.common.capabilities;
|
||||
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.Capability.IStorage;
|
||||
|
|
@ -10,23 +10,23 @@ import net.minecraftforge.common.capabilities.Capability.IStorage;
|
|||
public class PositionStorage implements IStorage<IPosition> {
|
||||
|
||||
@Override
|
||||
public INBTBase writeNBT(Capability<IPosition> capability, IPosition instance, EnumFacing side) {
|
||||
public INBT writeNBT(Capability<IPosition> capability, IPosition instance, Direction side) {
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
|
||||
tag.setBoolean("blockActivated", instance.isBlockActivated());
|
||||
tag.setInt("x", instance.getPos().getX());
|
||||
tag.setInt("y", instance.getPos().getY());
|
||||
tag.setInt("z", instance.getPos().getZ());
|
||||
tag.putBoolean("blockActivated", instance.isBlockActivated());
|
||||
tag.putInt("x", instance.getPos().getX());
|
||||
tag.putInt("y", instance.getPos().getY());
|
||||
tag.putInt("z", instance.getPos().getZ());
|
||||
|
||||
return tag;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability<IPosition> capability, IPosition instance, EnumFacing side, INBTBase nbt) {
|
||||
public void readNBT(Capability<IPosition> capability, IPosition instance, Direction side, INBT nbt) {
|
||||
|
||||
NBTTagCompound tag = (NBTTagCompound) nbt;
|
||||
CompoundNBT tag = (CompoundNBT) nbt;
|
||||
|
||||
int x = tag.getInt("x");
|
||||
int y = tag.getInt("y");
|
||||
|
|
@ -38,6 +38,7 @@ public class PositionStorage implements IStorage<IPosition> {
|
|||
instance.setBlockActivated(tag.getBoolean("blockActivated"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package tschipp.carryon.common.capabilities.event;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
|
@ -26,8 +26,8 @@ public class PositionClientEvents
|
|||
{
|
||||
if (event.getGui() != null)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
boolean inventory = event.getGui() instanceof GuiContainer;
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
boolean inventory = event.getGui() instanceof ContainerScreen;
|
||||
|
||||
if (player != null && inventory)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ public class PositionClientEvents
|
|||
@SubscribeEvent
|
||||
public void onGuiClose(PlayerContainerEvent.Close event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
if(player.getCapability(PositionProvider.POSITION_CAPABILITY).isPresent())
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY).orElse(new TEPosition());
|
||||
|
|
@ -76,7 +76,7 @@ public class PositionClientEvents
|
|||
{
|
||||
if (event.side == LogicalSide.CLIENT)
|
||||
{
|
||||
EntityPlayer player = event.player;
|
||||
PlayerEntity player = event.player;
|
||||
if(player.getCapability(PositionProvider.POSITION_CAPABILITY).isPresent())
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY).orElse(new TEPosition());
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package tschipp.carryon.common.capabilities.event;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
|
@ -21,7 +21,7 @@ public class PositionCommonEvents
|
|||
@SubscribeEvent
|
||||
public void onAttachCaps(AttachCapabilitiesEvent<Entity> event)
|
||||
{
|
||||
if (event.getObject() instanceof EntityPlayer)
|
||||
if (event.getObject() instanceof PlayerEntity)
|
||||
{
|
||||
event.addCapability(new ResourceLocation(CarryOn.MODID, "position"), new PositionProvider());
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class PositionCommonEvents
|
|||
{
|
||||
BlockPos pos = event.getPos();
|
||||
World world = event.getWorld();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
|
||||
if (event.isCanceled())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.Commands;
|
||||
import net.minecraft.command.arguments.EntityArgument;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fml.network.PacketDistributor;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.handler.CustomPickupOverrideHandler;
|
||||
import tschipp.carryon.common.handler.ModelOverridesHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.common.item.ItemCarryonEntity;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
import tschipp.carryon.common.scripting.ScriptReader;
|
||||
import tschipp.carryon.network.client.CarrySlotPacket;
|
||||
import tschipp.carryon.network.client.ScriptReloadPacket;
|
||||
|
|
@ -39,7 +39,7 @@ public class CommandCarryOn
|
|||
return handleClear(cmd.getSource(), Collections.singleton(cmd.getSource().asPlayer()));
|
||||
}))
|
||||
|
||||
.then(Commands.literal("clear").then(Commands.argument("target", EntityArgument.multiplePlayers()).requires(src -> src.hasPermissionLevel(2)).executes((cmd) -> {
|
||||
.then(Commands.literal("clear").then(Commands.argument("target", EntityArgument.players()).requires(src -> src.hasPermissionLevel(2)).executes((cmd) -> {
|
||||
return handleClear(cmd.getSource(), EntityArgument.getPlayers(cmd, "target"));
|
||||
})))
|
||||
|
||||
|
|
@ -57,45 +57,45 @@ public class CommandCarryOn
|
|||
{
|
||||
if (source.assertIsEntity() != null)
|
||||
{
|
||||
EntityPlayerMP player = source.asPlayer();
|
||||
ServerPlayerEntity player = source.asPlayer();
|
||||
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemTile)
|
||||
{
|
||||
source.sendFeedback(new TextComponentString("Block: " + ItemTile.getBlock(main)), true);
|
||||
source.sendFeedback(new TextComponentString("BlockState: " + ItemTile.getBlockState(main)), true);
|
||||
source.sendFeedback(new TextComponentString("ItemStack: " + ItemTile.getItemStack(main)), true);
|
||||
source.sendFeedback(new StringTextComponent("Block: " + ItemCarryonBlock.getBlock(main)), true);
|
||||
source.sendFeedback(new StringTextComponent("BlockState: " + ItemCarryonBlock.getBlockState(main)), true);
|
||||
source.sendFeedback(new StringTextComponent("ItemStack: " + ItemCarryonBlock.getItemStack(main)), true);
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemTile.getBlockState(main), ItemTile.getTileData(main)))
|
||||
source.sendFeedback(new TextComponentString("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemTile.getBlockState(main), ItemTile.getTileData(main))), true);
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main)))
|
||||
source.sendFeedback(new StringTextComponent("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main))), true);
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemTile.getBlockState(main)))
|
||||
source.sendFeedback(new TextComponentString("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemTile.getBlockState(main))), true);
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonBlock.getBlockState(main)))
|
||||
source.sendFeedback(new StringTextComponent("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonBlock.getBlockState(main))), true);
|
||||
|
||||
CarryOn.LOGGER.info("Block: " + ItemTile.getBlock(main));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemTile.getBlockState(main));
|
||||
CarryOn.LOGGER.info("ItemStack: " + ItemTile.getItemStack(main));
|
||||
CarryOn.LOGGER.info("Block: " + ItemCarryonBlock.getBlock(main));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemCarryonBlock.getBlockState(main));
|
||||
CarryOn.LOGGER.info("ItemStack: " + ItemCarryonBlock.getItemStack(main));
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemTile.getBlockState(main), ItemTile.getTileData(main)))
|
||||
CarryOn.LOGGER.info("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemTile.getBlockState(main), ItemTile.getTileData(main)));
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main)))
|
||||
CarryOn.LOGGER.info("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main)));
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemTile.getBlockState(main)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemTile.getBlockState(main)));
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonBlock.getBlockState(main)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonBlock.getBlockState(main)));
|
||||
|
||||
return 1;
|
||||
} else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity)
|
||||
{
|
||||
source.sendFeedback(new TextComponentString("Entity: " + ItemEntity.getEntity(main, player.world)), true);
|
||||
source.sendFeedback(new TextComponentString("Entity Name: " + ItemEntity.getEntityName(main)), true);
|
||||
source.sendFeedback(new StringTextComponent("Entity: " + ItemCarryonEntity.getEntity(main, player.world)), true);
|
||||
source.sendFeedback(new StringTextComponent("Entity Name: " + ItemCarryonEntity.getEntityName(main)), true);
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemEntity.getEntity(main, player.world)))
|
||||
source.sendFeedback(new TextComponentString("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemEntity.getEntity(main, player.world))), true);
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonEntity.getEntity(main, player.world)))
|
||||
source.sendFeedback(new StringTextComponent("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonEntity.getEntity(main, player.world))), true);
|
||||
|
||||
CarryOn.LOGGER.info("Entity: " + ItemEntity.getEntity(main, player.world));
|
||||
CarryOn.LOGGER.info("Entity Name: " + ItemEntity.getEntityName(main));
|
||||
CarryOn.LOGGER.info("Entity: " + ItemCarryonEntity.getEntity(main, player.world));
|
||||
CarryOn.LOGGER.info("Entity Name: " + ItemCarryonEntity.getEntityName(main));
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemEntity.getEntity(main, player.world)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemEntity.getEntity(main, player.world)));
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonEntity.getEntity(main, player.world)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonEntity.getEntity(main, player.world)));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -109,9 +109,9 @@ public class CommandCarryOn
|
|||
return 0;
|
||||
}
|
||||
|
||||
private static int handleClear(CommandSource source, Collection<EntityPlayerMP> players)
|
||||
private static int handleClear(CommandSource source, Collection<ServerPlayerEntity> players)
|
||||
{
|
||||
for (EntityPlayerMP player : players)
|
||||
for (ServerPlayerEntity player : players)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -121,12 +121,12 @@ public class CommandCarryOn
|
|||
cleared += player.inventory.clearMatchingItems(stack -> !stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile, 64);
|
||||
cleared += player.inventory.clearMatchingItems(stack -> !stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity, 64);
|
||||
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) player), new CarrySlotPacket(9, player.getEntityId()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new CarrySlotPacket(9, player.getEntityId()));
|
||||
|
||||
if (cleared != 1)
|
||||
source.sendFeedback(new TextComponentString("Cleared " + cleared + " Items!"), true);
|
||||
source.sendFeedback(new StringTextComponent("Cleared " + cleared + " Items!"), true);
|
||||
else
|
||||
source.sendFeedback(new TextComponentString("Cleared " + cleared + " Item!"), true);
|
||||
source.sendFeedback(new StringTextComponent("Cleared " + cleared + " Item!"), true);
|
||||
|
||||
return 1;
|
||||
} else
|
||||
|
|
@ -148,9 +148,9 @@ public class CommandCarryOn
|
|||
ScriptReader.reloadScripts();
|
||||
CarryOn.network.send(PacketDistributor.ALL.noArg(), new ScriptReloadPacket());
|
||||
|
||||
source.sendFeedback(new TextComponentString("Successfully reloaded scripts!"), true);
|
||||
source.sendFeedback(new StringTextComponent("Successfully reloaded scripts!"), true);
|
||||
} else
|
||||
source.sendErrorMessage(new TextComponentString("To use custom Carry On scripts, enable them in the config!"));
|
||||
source.sendErrorMessage(new StringTextComponent("To use custom Carry On scripts, enable them in the config!"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,18 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.entity.passive.horse.HorseEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
|
@ -34,7 +32,7 @@ import tschipp.carryon.common.config.Configs.Settings;
|
|||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.handler.PickupHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemCarryonEntity;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
|
||||
|
|
@ -44,11 +42,11 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onBlockClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
player.getEntityData().removeTag("carrySlot");
|
||||
player.getEntityData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
||||
if (!player.world.isRemote)
|
||||
|
|
@ -71,19 +69,19 @@ public class ItemEntityEvents
|
|||
{
|
||||
Entity e = event.getEntity();
|
||||
World world = event.getWorld();
|
||||
if (e instanceof EntityItem)
|
||||
if (e instanceof net.minecraft.entity.item.ItemEntity)
|
||||
{
|
||||
EntityItem eitem = (EntityItem) e;
|
||||
net.minecraft.entity.item.ItemEntity eitem = (net.minecraft.entity.item.ItemEntity) e;
|
||||
ItemStack stack = eitem.getItem();
|
||||
Item item = stack.getItem();
|
||||
if (item == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
if (item == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
BlockPos pos = eitem.getPosition();
|
||||
Entity entity = ItemEntity.getEntity(stack, world);
|
||||
Entity entity = ItemCarryonEntity.getEntity(stack, world);
|
||||
entity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
world.spawnEntity(entity);
|
||||
world.addEntity(entity);
|
||||
|
||||
ItemEntity.clearEntityData(stack);
|
||||
ItemCarryonEntity.clearEntityData(stack);
|
||||
eitem.setItem(ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
|
@ -92,9 +90,9 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onEntityRightClick(PlayerInteractEvent.EntityInteract event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
|
||||
if (player instanceof EntityPlayerMP)
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
{
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
ItemStack off = player.getHeldItemOffhand();
|
||||
|
|
@ -108,12 +106,12 @@ public class ItemEntityEvents
|
|||
|
||||
if (entity.hurtResistantTime == 0)
|
||||
{
|
||||
if (entity instanceof EntityAnimal)
|
||||
((EntityAnimal) entity).clearLeashed(true, true);
|
||||
if (entity instanceof AnimalEntity)
|
||||
((AnimalEntity) entity).clearLeashed(true, true);
|
||||
|
||||
if (PickupHandler.canPlayerPickUpEntity(player, entity))
|
||||
{
|
||||
if (ItemEntity.storeEntityData(entity, world, stack))
|
||||
if (ItemCarryonEntity.storeEntityData(entity, world, stack))
|
||||
{
|
||||
LazyOptional<IItemHandler> handler = entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY);
|
||||
|
||||
|
|
@ -131,29 +129,30 @@ public class ItemEntityEvents
|
|||
|
||||
ItemEvents.sendPacket(player, player.inventory.currentItem, overrideHash);
|
||||
|
||||
if (entity instanceof EntityLiving)
|
||||
((EntityLiving) entity).setHealth(0);
|
||||
if (entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).setHealth(0);
|
||||
|
||||
entity.posY=0;
|
||||
entity.remove();
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, stack);
|
||||
player.setHeldItem(Hand.MAIN_HAND, stack);
|
||||
event.setCanceled(true);
|
||||
event.setCancellationResult(EnumActionResult.FAIL);
|
||||
event.setCancellationResult(ActionResultType.FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(main) && !CarryOnKeybinds.isKeyPressed(player) && Settings.stackableEntities.get())
|
||||
} else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(main) && !CarryOnKeybinds.isKeyPressed(player) && Settings.stackableEntities.get())
|
||||
{
|
||||
Entity entityHeld = ItemEntity.getEntity(main, world);
|
||||
Entity entityHeld = ItemCarryonEntity.getEntity(main, world);
|
||||
|
||||
if (entity.hurtResistantTime == 0 && entityHeld instanceof EntityLivingBase)
|
||||
if (entity.hurtResistantTime == 0 && entityHeld instanceof LivingEntity)
|
||||
{
|
||||
|
||||
if (!world.isRemote && entityHeld.getUniqueID() != entity.getUniqueID() && !entityHeld.removed && !entity.removed)
|
||||
if (!world.isRemote && entityHeld.getUniqueID() != entity.getUniqueID() && !entityHeld.isAlive() && !entity.isAlive())
|
||||
{
|
||||
|
||||
double sizeHeldEntity = entityHeld.height * entityHeld.width;
|
||||
double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ);
|
||||
double sizeHeldEntity = entityHeld.getHeight() * entityHeld.getWidth();
|
||||
double distance = pos.distanceSq(player.getPosition());
|
||||
Entity lowestEntity = entity.getLowestRidingEntity();
|
||||
int numPassengers = getAllPassengers(lowestEntity);
|
||||
if (numPassengers < Settings.maxEntityStackLimit.get() - 1)
|
||||
|
|
@ -162,12 +161,12 @@ public class ItemEntityEvents
|
|||
|
||||
if (Settings.useWhitelistStacking.get() ? ListHandler.isStackingAllowed(topEntity) : !ListHandler.isStackingForbidden(topEntity))
|
||||
{
|
||||
double sizeEntity = topEntity.height * topEntity.width;
|
||||
double sizeEntity = topEntity.getHeight() * topEntity.getWidth();
|
||||
if ((Settings.entitySizeMattersStacking.get() && sizeHeldEntity <= sizeEntity) || !Settings.entitySizeMattersStacking.get())
|
||||
{
|
||||
if (topEntity instanceof EntityHorse)
|
||||
if (topEntity instanceof HorseEntity)
|
||||
{
|
||||
EntityHorse horse = (EntityHorse) topEntity;
|
||||
HorseEntity horse = (HorseEntity) topEntity;
|
||||
horse.setHorseTamed(true);
|
||||
}
|
||||
|
||||
|
|
@ -177,21 +176,21 @@ public class ItemEntityEvents
|
|||
double tempY = entity.posY;
|
||||
double tempZ = entity.posZ;
|
||||
entityHeld.setPosition(tempX, tempY + 2.6, tempZ);
|
||||
world.spawnEntity(entityHeld);
|
||||
world.addEntity(entityHeld);
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
entityHeld.setPositionAndUpdate(tempX, tempY, tempZ);
|
||||
} else
|
||||
{
|
||||
entityHeld.setPosition(entity.posX, entity.posY, entity.posZ);
|
||||
world.spawnEntity(entityHeld);
|
||||
world.addEntity(entityHeld);
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
}
|
||||
|
||||
ItemEntity.clearEntityData(main);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemCarryonEntity.clearEntityData(main);
|
||||
player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
event.setCanceled(true);
|
||||
event.setCancellationResult(EnumActionResult.FAIL);
|
||||
event.setCancellationResult(ActionResultType.FAIL);
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_HORSE_SADDLE, SoundCategory.PLAYERS, 0.5F, 1.5F);
|
||||
} else
|
||||
{
|
||||
|
|
@ -248,21 +247,21 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingUpdateEvent event)
|
||||
{
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
World world = entity.world;
|
||||
ItemStack main = entity.getHeldItemMainhand();
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(main))
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(main))
|
||||
{
|
||||
BlockPos pos = entity.getPosition();
|
||||
BlockPos below = pos.offset(EnumFacing.DOWN);
|
||||
BlockPos below = pos.offset(Direction.DOWN);
|
||||
|
||||
if (world.getBlockState(pos).getMaterial() == Material.WATER || world.getBlockState(below).getMaterial() == Material.WATER)
|
||||
{
|
||||
Entity contained = ItemEntity.getEntity(main, world);
|
||||
Entity contained = ItemCarryonEntity.getEntity(main, world);
|
||||
if (contained != null)
|
||||
{
|
||||
float height = contained.height;
|
||||
float width = contained.width;
|
||||
float height = contained.getWidth();
|
||||
float width = contained.getWidth();
|
||||
|
||||
entity.addVelocity(0, -0.01 * height * width, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,26 +4,29 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.DirectionalPlaceContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.ClickEvent.Action;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.GameRules.BooleanValue;
|
||||
import net.minecraft.world.GameRules.RuleKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
|
|
@ -57,8 +60,8 @@ import tschipp.carryon.common.handler.CustomPickupOverrideHandler;
|
|||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.handler.PickupHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
import tschipp.carryon.common.item.ItemCarryonEntity;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
import tschipp.carryon.common.scripting.ScriptReader;
|
||||
|
|
@ -75,11 +78,11 @@ public class ItemEvents
|
|||
if (event.isCanceled())
|
||||
return;
|
||||
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
player.getEntityData().removeTag("carrySlot");
|
||||
player.getEntityData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
||||
if (!player.world.isRemote)
|
||||
|
|
@ -102,23 +105,23 @@ public class ItemEvents
|
|||
{
|
||||
Entity e = event.getEntity();
|
||||
World world = event.getWorld();
|
||||
if (e instanceof EntityItem)
|
||||
if (e instanceof net.minecraft.entity.item.ItemEntity)
|
||||
{
|
||||
EntityItem eitem = (EntityItem) e;
|
||||
net.minecraft.entity.item.ItemEntity eitem = (net.minecraft.entity.item.ItemEntity) e;
|
||||
ItemStack stack = eitem.getItem();
|
||||
Item item = stack.getItem();
|
||||
if (item == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
|
||||
if (item == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
BlockPos pos = eitem.getPosition();
|
||||
BlockPos finalPos = pos;
|
||||
BlockItemUseContext context = new BlockItemUseContext(world, null, stack, pos, EnumFacing.DOWN, 0f, 0f, 0f);
|
||||
BlockItemUseContext context = new DirectionalPlaceContext(world, pos, Direction.DOWN, stack, Direction.UP);
|
||||
|
||||
if (!world.getBlockState(pos).isReplaceable(context) || !context.canPlace())
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.values())
|
||||
for (Direction facing : Direction.values())
|
||||
{
|
||||
BlockPos offsetPos = pos.offset(facing);
|
||||
BlockItemUseContext newContext = new BlockItemUseContext(world, null, stack, offsetPos, EnumFacing.DOWN, 0, 0, 0);
|
||||
BlockItemUseContext newContext = new DirectionalPlaceContext(world, offsetPos, Direction.DOWN, stack, Direction.UP);
|
||||
if (world.getBlockState(offsetPos).isReplaceable(newContext) && newContext.canPlace())
|
||||
{
|
||||
finalPos = offsetPos;
|
||||
|
|
@ -126,14 +129,14 @@ public class ItemEvents
|
|||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(finalPos, ItemTile.getBlockState(stack));
|
||||
world.setBlockState(finalPos, ItemCarryonBlock.getBlockState(stack));
|
||||
TileEntity tile = world.getTileEntity(finalPos);
|
||||
if (tile != null)
|
||||
{
|
||||
tile.deserializeNBT(ItemTile.getTileData(stack));
|
||||
tile.deserializeNBT(ItemCarryonBlock.getTileData(stack));
|
||||
tile.setPos(finalPos);
|
||||
}
|
||||
ItemTile.clearTileData(stack);
|
||||
ItemCarryonBlock.clearTileData(stack);
|
||||
eitem.setItem(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
|
|
@ -149,9 +152,9 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void onPlayerLogin(PlayerLoggedInEvent event)
|
||||
{
|
||||
if (event.getPlayer() instanceof EntityPlayer)
|
||||
if (event.getPlayer() instanceof PlayerEntity)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.getPlayer();
|
||||
PlayerEntity player = (PlayerEntity) event.getPlayer();
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
ItemStack carried = player.getHeldItemMainhand();
|
||||
|
|
@ -159,18 +162,18 @@ public class ItemEvents
|
|||
{
|
||||
if (carried.getItem() == RegistrationHandler.itemTile)
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(ItemTile.getBlockState(carried), world, player.getPosition(), ItemTile.getTileData(carried));
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(ItemCarryonBlock.getBlockState(carried), world, player.getPosition(), ItemCarryonBlock.getTileData(carried));
|
||||
if (override != null)
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
else
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
} else
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.inspectEntity(ItemEntity.getEntity(carried, world));
|
||||
CarryOnOverride override = ScriptChecker.inspectEntity(ItemCarryonEntity.getEntity(carried, world));
|
||||
if (override != null)
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
else
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -192,11 +195,11 @@ public class ItemEvents
|
|||
public void onEntityStartTracking(StartTracking event)
|
||||
{
|
||||
Entity e = event.getTarget();
|
||||
EntityPlayer tracker = event.getEntityPlayer();
|
||||
PlayerEntity tracker = event.getEntityPlayer();
|
||||
|
||||
if (e instanceof EntityPlayer && tracker instanceof EntityPlayerMP)
|
||||
if (e instanceof PlayerEntity && tracker instanceof ServerPlayerEntity)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
PlayerEntity player = (PlayerEntity) e;
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
ItemStack carried = player.getHeldItemMainhand();
|
||||
|
|
@ -204,18 +207,18 @@ public class ItemEvents
|
|||
{
|
||||
if (carried.getItem() == RegistrationHandler.itemTile)
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(ItemTile.getBlockState(carried), world, player.getPosition(), ItemTile.getTileData(carried));
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(ItemCarryonBlock.getBlockState(carried), world, player.getPosition(), ItemCarryonBlock.getTileData(carried));
|
||||
if (override != null)
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
else
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
} else
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.inspectEntity(ItemEntity.getEntity(carried, world));
|
||||
CarryOnOverride override = ScriptChecker.inspectEntity(ItemCarryonEntity.getEntity(carried, world));
|
||||
if (override != null)
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId(), override.hashCode()));
|
||||
else
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) tracker), new CarrySlotPacket(player.inventory.currentItem, player.getEntityId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +228,7 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void harvestSpeed(BreakSpeed event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
if (player != null && !Settings.hitWhileCarrying.get())
|
||||
{
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
@ -237,7 +240,7 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void attackEntity(AttackEntityEvent event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && !Settings.hitWhileCarrying.get() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
{
|
||||
|
|
@ -248,7 +251,7 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void harvestSpeed(BreakEvent event)
|
||||
{
|
||||
EntityPlayer player = event.getPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if (player != null && !Settings.hitWhileCarrying.get())
|
||||
{
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
@ -260,19 +263,19 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void playerAttack(LivingAttackEvent event)
|
||||
{
|
||||
EntityLivingBase eliving = event.getEntityLiving();
|
||||
if (eliving instanceof EntityPlayer && Settings.dropCarriedWhenHit.get())
|
||||
LivingEntity eliving = event.getEntityLiving();
|
||||
if (eliving instanceof PlayerEntity && Settings.dropCarriedWhenHit.get())
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) eliving;
|
||||
PlayerEntity player = (PlayerEntity) eliving;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
{
|
||||
if (!player.world.isRemote)
|
||||
{
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
EntityItem item = new EntityItem(player.world, player.posX, player.posY, player.posZ, stack);
|
||||
player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEntity item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, stack);
|
||||
sendPacket(player, 9, 0);
|
||||
player.world.spawnEntity(item);
|
||||
player.world.addEntity(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -303,16 +306,16 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
|
||||
if (player instanceof EntityPlayerMP)
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
{
|
||||
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
ItemStack off = player.getHeldItemOffhand();
|
||||
World world = event.getWorld();
|
||||
BlockPos pos = event.getPos();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
||||
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player))
|
||||
{
|
||||
|
|
@ -324,12 +327,12 @@ public class ItemEvents
|
|||
{
|
||||
player.closeScreen();
|
||||
|
||||
if (ItemTile.storeTileData(te, world, pos, state, stack))
|
||||
if (ItemCarryonBlock.storeTileData(te, world, pos, state, stack))
|
||||
{
|
||||
|
||||
IBlockState statee = world.getBlockState(pos);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag = world.getTileEntity(pos) != null ? world.getTileEntity(pos).write(tag) : new NBTTagCompound();
|
||||
BlockState statee = world.getBlockState(pos);
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
tag = world.getTileEntity(pos) != null ? world.getTileEntity(pos).write(tag) : new CompoundNBT();
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(state, world, pos, tag);
|
||||
int overrideHash = 0;
|
||||
if (override != null)
|
||||
|
|
@ -344,8 +347,8 @@ public class ItemEvents
|
|||
sendPacket(player, player.inventory.currentItem, overrideHash);
|
||||
|
||||
world.removeTileEntity(pos);
|
||||
world.removeBlock(pos);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, stack);
|
||||
world.removeBlock(pos, false);
|
||||
player.setHeldItem(Hand.MAIN_HAND, stack);
|
||||
event.setUseBlock(Result.DENY);
|
||||
event.setUseItem(Result.DENY);
|
||||
event.setCanceled(true);
|
||||
|
|
@ -356,8 +359,8 @@ public class ItemEvents
|
|||
{
|
||||
sendPacket(player, player.inventory.currentItem, overrideHash);
|
||||
emptyTileEntity(te);
|
||||
world.removeBlock(pos);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, stack);
|
||||
world.removeBlock(pos,false);
|
||||
player.setHeldItem(Hand.MAIN_HAND, stack);
|
||||
event.setUseBlock(Result.DENY);
|
||||
event.setUseItem(Result.DENY);
|
||||
event.setCanceled(true);
|
||||
|
|
@ -369,10 +372,10 @@ public class ItemEvents
|
|||
if (!tag.isEmpty())
|
||||
TileEntity.create(tag);
|
||||
|
||||
player.sendMessage(new TextComponentString(TextFormatting.RED + "Error detected. Cannot pick up block."));
|
||||
TextComponentString s = new TextComponentString(TextFormatting.GOLD + "here");
|
||||
player.sendMessage(new StringTextComponent(TextFormatting.RED + "Error detected. Cannot pick up block."));
|
||||
StringTextComponent s = new StringTextComponent(TextFormatting.GOLD + "here");
|
||||
s.getStyle().setClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
|
||||
player.sendMessage(new TextComponentString(TextFormatting.RED + "Please report this error ").appendSibling(s));
|
||||
player.sendMessage(new StringTextComponent(TextFormatting.RED + "Please report this error ").appendSibling(s));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -395,7 +398,7 @@ public class ItemEvents
|
|||
{
|
||||
if (te != null)
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.values())
|
||||
for (Direction facing : Direction.values())
|
||||
{
|
||||
LazyOptional<IItemHandler> itemHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing);
|
||||
|
||||
|
|
@ -443,11 +446,11 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void onRespawn(PlayerEvent.Clone event)
|
||||
{
|
||||
EntityPlayer original = event.getOriginal();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity original = event.getOriginal();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
boolean wasDead = event.isWasDeath();
|
||||
GameRules rules = player.world.getGameRules();
|
||||
boolean keepInv = rules.getBoolean("keepInventory");
|
||||
boolean keepInv = rules.getBoolean(new RuleKey<BooleanValue>("keepInventory"));
|
||||
boolean wasCarrying = player.inventory.hasItemStack(new ItemStack(RegistrationHandler.itemTile)) || player.inventory.hasItemStack(new ItemStack(RegistrationHandler.itemEntity));
|
||||
|
||||
if ((wasDead ? keepInv : true) && wasCarrying)
|
||||
|
|
@ -457,13 +460,13 @@ public class ItemEvents
|
|||
ItemStack stack = player.inventory.removeStackFromSlot(carrySlot);
|
||||
World world = player.world;
|
||||
|
||||
EntityItem item = new EntityItem(world);
|
||||
ItemEntity item = new ItemEntity(world, 0, 0, 0);
|
||||
item.setItem(stack);
|
||||
BlockPos pos = original.getBedLocation(original.dimension);
|
||||
if (pos == null)
|
||||
pos = player.getPosition();
|
||||
item.setPosition(pos.getX(), pos.getY(), pos.getZ());
|
||||
world.spawnEntity(item);
|
||||
world.addEntity(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -471,10 +474,10 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void dropNonHotbarItems(LivingUpdateEvent event)
|
||||
{
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
if (entity instanceof EntityPlayer)
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
if (entity instanceof PlayerEntity)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
PlayerEntity player = (PlayerEntity) entity;
|
||||
|
||||
if (!entity.world.isRemote)
|
||||
{
|
||||
|
|
@ -490,20 +493,20 @@ public class ItemEvents
|
|||
|
||||
|
||||
|
||||
EntityItem item = null;
|
||||
ItemEntity item = null;
|
||||
if (slotBlock != -1)
|
||||
{
|
||||
ItemStack dropped = player.inventory.removeStackFromSlot(slotBlock);
|
||||
item = new EntityItem(player.world, player.posX, player.posY, player.posZ, dropped);
|
||||
item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, dropped);
|
||||
}
|
||||
if (slotEntity != -1)
|
||||
{
|
||||
ItemStack dropped = player.inventory.removeStackFromSlot(slotEntity);
|
||||
item = new EntityItem(player.world, player.posX, player.posY, player.posZ, dropped);
|
||||
item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, dropped);
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
player.world.spawnEntity(item);
|
||||
player.world.addEntity(item);
|
||||
sendPacket(player, 9, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -535,7 +538,7 @@ public class ItemEvents
|
|||
}
|
||||
}
|
||||
|
||||
public int getSlot(EntityPlayer player, Item item)
|
||||
public int getSlot(PlayerEntity player, Item item)
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
|
|
@ -546,20 +549,20 @@ public class ItemEvents
|
|||
return -1;
|
||||
}
|
||||
|
||||
public static void sendPacket(EntityPlayer player, int currentItem, int hash)
|
||||
public static void sendPacket(PlayerEntity player, int currentItem, int hash)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP)
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
{
|
||||
CarryOn.network.send(PacketDistributor.NEAR.with(() -> new TargetPoint(player.posX, player.posY, player.posZ, 128, player.world.getDimension().getType())), new CarrySlotPacket(currentItem, player.getEntityId(), hash));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (EntityPlayerMP) player), new CarrySlotPacket(currentItem, player.getEntityId(), hash));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new CarrySlotPacket(currentItem, player.getEntityId(), hash));
|
||||
|
||||
if (currentItem >= 9)
|
||||
{
|
||||
player.getEntityData().removeTag("carrySlot");
|
||||
player.getEntityData().removeTag("overrideKey");
|
||||
player.getEntityData().remove("carrySlot");
|
||||
player.getEntityData().remove("overrideKey");
|
||||
} else
|
||||
{
|
||||
player.getEntityData().setInt("carrySlot", currentItem);
|
||||
player.getEntityData().putInt("carrySlot", currentItem);
|
||||
if (hash != 0)
|
||||
ScriptChecker.setCarryOnOverride(player, hash);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package tschipp.carryon.common.handler;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
|
@ -74,7 +74,7 @@ public class CustomPickupOverrideHandler
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean hasSpecialPickupConditions(IBlockState state)
|
||||
public static boolean hasSpecialPickupConditions(BlockState state)
|
||||
{
|
||||
if (!ModList.get().isLoaded("gamestages"))
|
||||
return false;
|
||||
|
|
@ -86,7 +86,7 @@ public class CustomPickupOverrideHandler
|
|||
return absolute;
|
||||
}
|
||||
|
||||
public static String getPickupCondition(IBlockState state)
|
||||
public static String getPickupCondition(BlockState state)
|
||||
{
|
||||
String block = state.getBlock().getRegistryName().toString();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ import java.util.Set;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
|
@ -25,7 +25,7 @@ import tschipp.carryon.common.helper.StringParser;
|
|||
|
||||
public class ModelOverridesHandler
|
||||
{
|
||||
public static HashMap<NBTTagCompound, Object> OVERRIDE_OBJECTS = new HashMap<NBTTagCompound, Object>();
|
||||
public static HashMap<CompoundNBT, Object> OVERRIDE_OBJECTS = new HashMap<CompoundNBT, Object>();
|
||||
|
||||
/*
|
||||
* This class is really ugly, will probably be replaced by something else -
|
||||
|
|
@ -37,7 +37,7 @@ public class ModelOverridesHandler
|
|||
|
||||
Object toOverrideObject;
|
||||
Object overrideObject;
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
|
||||
String currentline = overrideString;
|
||||
if (StringUtils.isEmpty(currentline) || !StringUtils.contains(currentline, "->"))
|
||||
|
|
@ -127,16 +127,16 @@ public class ModelOverridesHandler
|
|||
|
||||
if (overrideObject != null)
|
||||
{
|
||||
NBTTagCompound keyComp = new NBTTagCompound();
|
||||
keyComp.setTag("nbttag", tag);
|
||||
CompoundNBT keyComp = new CompoundNBT();
|
||||
keyComp.put("nbttag", tag);
|
||||
if (toOverrideObject instanceof Block)
|
||||
{
|
||||
keyComp.setString("block", ((Block) toOverrideObject).getRegistryName().toString());
|
||||
keyComp.putString("block", ((Block) toOverrideObject).getRegistryName().toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
keyComp.setInt("stateid", Block.getStateId((IBlockState) toOverrideObject));
|
||||
keyComp.setString("block", ((IBlockState) toOverrideObject).getBlock().getRegistryName().toString());
|
||||
keyComp.putInt("stateid", Block.getStateId((BlockState) toOverrideObject));
|
||||
keyComp.putString("block", ((BlockState) toOverrideObject).getBlock().getRegistryName().toString());
|
||||
}
|
||||
OVERRIDE_OBJECTS.put(keyComp, overrideObject);
|
||||
}
|
||||
|
|
@ -156,21 +156,21 @@ public class ModelOverridesHandler
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean hasCustomOverrideModel(IBlockState state, NBTTagCompound tag)
|
||||
public static boolean hasCustomOverrideModel(BlockState state, CompoundNBT tag)
|
||||
{
|
||||
if (OVERRIDE_OBJECTS.isEmpty())
|
||||
return false;
|
||||
|
||||
int stateid = Block.getStateId(state);
|
||||
NBTTagCompound[] keys = new NBTTagCompound[OVERRIDE_OBJECTS.size()];
|
||||
CompoundNBT[] keys = new CompoundNBT[OVERRIDE_OBJECTS.size()];
|
||||
OVERRIDE_OBJECTS.keySet().toArray(keys);
|
||||
for (NBTTagCompound key : keys)
|
||||
for (CompoundNBT key : keys)
|
||||
{
|
||||
int id = key.getInt("stateid");
|
||||
Block block = StringParser.getBlock(key.getString("block"));
|
||||
if (id == 0 ? block == state.getBlock() : id == stateid)
|
||||
{
|
||||
NBTTagCompound toCheckForCompound = key.getCompound("nbttag");
|
||||
CompoundNBT toCheckForCompound = key.getCompound("nbttag");
|
||||
Set<String> kSetToCheck = toCheckForCompound.keySet();
|
||||
Set<String> kSetTile = tag.keySet();
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ public class ModelOverridesHandler
|
|||
{
|
||||
for (String skey : kSetToCheck)
|
||||
{
|
||||
if (!NBTUtil.areNBTEquals(tag.getTag(skey), toCheckForCompound.getTag(skey), true))
|
||||
if (!NBTUtil.areNBTEquals(tag.get(skey), toCheckForCompound.get(skey), true))
|
||||
flag = false;
|
||||
}
|
||||
if (flag)
|
||||
|
|
@ -192,18 +192,18 @@ public class ModelOverridesHandler
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static IBakedModel getCustomOverrideModel(IBlockState state, NBTTagCompound tag, World world, EntityPlayer player)
|
||||
public static IBakedModel getCustomOverrideModel(BlockState state, CompoundNBT tag, World world, PlayerEntity player)
|
||||
{
|
||||
int stateid = Block.getStateId(state);
|
||||
NBTTagCompound[] keys = new NBTTagCompound[OVERRIDE_OBJECTS.size()];
|
||||
CompoundNBT[] keys = new CompoundNBT[OVERRIDE_OBJECTS.size()];
|
||||
OVERRIDE_OBJECTS.keySet().toArray(keys);
|
||||
for (NBTTagCompound key : keys)
|
||||
for (CompoundNBT key : keys)
|
||||
{
|
||||
int id = key.getInt("stateid");
|
||||
Block block = StringParser.getBlock(key.getString("block"));
|
||||
if (id == 0 ? block == state.getBlock() : id == stateid)
|
||||
{
|
||||
NBTTagCompound toCheckForCompound = key.getCompound("nbttag");
|
||||
CompoundNBT toCheckForCompound = key.getCompound("nbttag");
|
||||
Set<String> kSetToCheck = toCheckForCompound.keySet();
|
||||
Set<String> kSetTile = tag.keySet();
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ public class ModelOverridesHandler
|
|||
{
|
||||
for (String skey : kSetToCheck)
|
||||
{
|
||||
if (!NBTUtil.areNBTEquals(tag.getTag(skey), toCheckForCompound.getTag(skey), true))
|
||||
if (!NBTUtil.areNBTEquals(tag.get(skey), toCheckForCompound.get(skey), true))
|
||||
flag = false;
|
||||
}
|
||||
if (flag)
|
||||
|
|
@ -222,8 +222,8 @@ public class ModelOverridesHandler
|
|||
if (override == null)
|
||||
return null;
|
||||
|
||||
if (override instanceof IBlockState)
|
||||
return Minecraft.getInstance().getBlockRendererDispatcher().getModelForState((IBlockState) override);
|
||||
if (override instanceof BlockState)
|
||||
return Minecraft.getInstance().getBlockRendererDispatcher().getModelForState((BlockState) override);
|
||||
else
|
||||
return Minecraft.getInstance().getItemRenderer().getItemModelWithOverrides((ItemStack) override, world, player);
|
||||
}
|
||||
|
|
@ -234,18 +234,18 @@ public class ModelOverridesHandler
|
|||
|
||||
}
|
||||
|
||||
public static Object getOverrideObject(IBlockState state, NBTTagCompound tag)
|
||||
public static Object getOverrideObject(BlockState state, CompoundNBT tag)
|
||||
{
|
||||
int stateid = Block.getStateId(state);
|
||||
NBTTagCompound[] keys = new NBTTagCompound[OVERRIDE_OBJECTS.size()];
|
||||
CompoundNBT[] keys = new CompoundNBT[OVERRIDE_OBJECTS.size()];
|
||||
OVERRIDE_OBJECTS.keySet().toArray(keys);
|
||||
for (NBTTagCompound key : keys)
|
||||
for (CompoundNBT key : keys)
|
||||
{
|
||||
int id = key.getInt("stateid");
|
||||
Block block = StringParser.getBlock(key.getString("block"));
|
||||
if (id == 0 ? block == state.getBlock() : id == stateid)
|
||||
{
|
||||
NBTTagCompound toCheckForCompound = key.getCompound("nbttag");
|
||||
CompoundNBT toCheckForCompound = key.getCompound("nbttag");
|
||||
Set<String> kSetToCheck = toCheckForCompound.keySet();
|
||||
Set<String> kSetTile = tag.keySet();
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ public class ModelOverridesHandler
|
|||
{
|
||||
for (String skey : kSetToCheck)
|
||||
{
|
||||
if (!NBTUtil.areNBTEquals(tag.getTag(skey), toCheckForCompound.getTag(skey), true))
|
||||
if (!NBTUtil.areNBTEquals(tag.get(skey), toCheckForCompound.get(skey), true))
|
||||
flag = false;
|
||||
}
|
||||
if (flag)
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import java.util.UUID;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.AgeableEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.EntityClassification;
|
||||
import net.minecraft.entity.passive.TameableEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
|
@ -21,25 +21,25 @@ import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
|||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
|
||||
public class PickupHandler
|
||||
{
|
||||
|
||||
public static boolean canPlayerPickUpBlock(EntityPlayer player, @Nullable TileEntity tile, World world, BlockPos pos)
|
||||
public static boolean canPlayerPickUpBlock(PlayerEntity player, @Nullable TileEntity tile, World world, BlockPos pos)
|
||||
{
|
||||
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
BlockState state = world.getBlockState(pos);
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
if (tile != null)
|
||||
tile.write(tag);
|
||||
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(world.getBlockState(pos), world, pos, tag);
|
||||
if (override != null)
|
||||
{
|
||||
return (ScriptChecker.fulfillsConditions(override, player)) && handleProtections((EntityPlayerMP) player, world, pos, state);
|
||||
return (ScriptChecker.fulfillsConditions(override, player)) && handleProtections((ServerPlayerEntity) player, world, pos, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -60,12 +60,12 @@ public class PickupHandler
|
|||
|
||||
if ((state.getBlockHardness(world, pos) != -1 || player.isCreative()))
|
||||
{
|
||||
double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ);
|
||||
double distance = pos.distanceSq(player.getPosition());
|
||||
|
||||
if (distance < Math.pow(Settings.maxDistance.get(), 2))
|
||||
{
|
||||
|
||||
if (!ItemTile.isLocked(pos, world))
|
||||
if (!ItemCarryonBlock.isLocked(pos, world))
|
||||
{
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(state))
|
||||
|
|
@ -75,7 +75,7 @@ public class PickupHandler
|
|||
Class<?> gameStageHelper = Class.forName("net.darkhax.gamestages.GameStageHelper");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.data.IStageData");
|
||||
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", EntityPlayer.class);
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", PlayerEntity.class);
|
||||
Method hasStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasStage", String.class);
|
||||
|
||||
Object stageData = getPlayerData.invoke(null, player);
|
||||
|
|
@ -83,7 +83,7 @@ public class PickupHandler
|
|||
boolean has = (boolean) hasStage.invoke(stageData, condition);
|
||||
|
||||
if (has)
|
||||
return handleProtections((EntityPlayerMP) player, world, pos, state);
|
||||
return handleProtections((ServerPlayerEntity) player, world, pos, state);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -92,7 +92,7 @@ public class PickupHandler
|
|||
Class<?> playerDataHandler = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler$IStageData");
|
||||
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", EntityPlayer.class);
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", PlayerEntity.class);
|
||||
Method hasUnlockedStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasUnlockedStage", String.class);
|
||||
|
||||
Object stageData = getStageData.invoke(null, player);
|
||||
|
|
@ -100,18 +100,18 @@ public class PickupHandler
|
|||
boolean has = (boolean) hasUnlockedStage.invoke(stageData, condition);
|
||||
|
||||
if (has)
|
||||
return handleProtections((EntityPlayerMP) player, world, pos, state);
|
||||
return handleProtections((ServerPlayerEntity) player, world, pos, state);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return handleProtections((EntityPlayerMP) player, world, pos, state);
|
||||
return handleProtections((ServerPlayerEntity) player, world, pos, state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (Settings.pickupAllBlocks.get() ? true : tile != null)
|
||||
{
|
||||
return handleProtections((EntityPlayerMP) player, world, pos, state);
|
||||
return handleProtections((ServerPlayerEntity) player, world, pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -122,33 +122,33 @@ public class PickupHandler
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean canPlayerPickUpEntity(EntityPlayer player, Entity toPickUp)
|
||||
public static boolean canPlayerPickUpEntity(PlayerEntity player, Entity toPickUp)
|
||||
{
|
||||
BlockPos pos = toPickUp.getPosition();
|
||||
|
||||
if (toPickUp instanceof EntityPlayer)
|
||||
if (toPickUp instanceof PlayerEntity)
|
||||
return false;
|
||||
|
||||
CarryOnOverride override = ScriptChecker.inspectEntity(toPickUp);
|
||||
if (override != null)
|
||||
{
|
||||
return (ScriptChecker.fulfillsConditions(override, player)) && handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return (ScriptChecker.fulfillsConditions(override, player)) && handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (toPickUp instanceof EntityAgeable && Settings.allowBabies.get())
|
||||
if (toPickUp instanceof AgeableEntity && Settings.allowBabies.get())
|
||||
{
|
||||
EntityAgeable living = (EntityAgeable) toPickUp;
|
||||
AgeableEntity living = (AgeableEntity) toPickUp;
|
||||
if (living.getGrowingAge() < 0 || living.isChild())
|
||||
{
|
||||
|
||||
double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ);
|
||||
double distance = pos.distanceSq(player.getPosition());
|
||||
if (distance < Math.pow(Settings.maxDistance.get(), 2))
|
||||
{
|
||||
if (toPickUp instanceof EntityTameable)
|
||||
if (toPickUp instanceof TameableEntity)
|
||||
{
|
||||
EntityTameable tame = (EntityTameable) toPickUp;
|
||||
if (tame.getOwnerId() != null && tame.getOwnerId() != EntityPlayer.getUUID(player.getGameProfile()))
|
||||
TameableEntity tame = (TameableEntity) toPickUp;
|
||||
if (tame.getOwnerId() != null && tame.getOwnerId() != PlayerEntity.getUUID(player.getGameProfile()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ public class PickupHandler
|
|||
Class<?> gameStageHelper = Class.forName("net.darkhax.gamestages.GameStageHelper");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.data.IStageData");
|
||||
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", EntityPlayer.class);
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", PlayerEntity.class);
|
||||
Method hasStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasStage", String.class);
|
||||
|
||||
Object stageData = getPlayerData.invoke(null, player);
|
||||
|
|
@ -168,7 +168,7 @@ public class PickupHandler
|
|||
boolean has = (boolean) hasStage.invoke(stageData, condition);
|
||||
|
||||
if (has)
|
||||
return handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@ public class PickupHandler
|
|||
Class<?> playerDataHandler = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler$IStageData");
|
||||
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", EntityPlayer.class);
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", PlayerEntity.class);
|
||||
Method hasUnlockedStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasUnlockedStage", String.class);
|
||||
|
||||
Object stageData = getStageData.invoke(null, player);
|
||||
|
|
@ -185,16 +185,16 @@ public class PickupHandler
|
|||
boolean has = (boolean) hasUnlockedStage.invoke(stageData, condition);
|
||||
|
||||
if (has)
|
||||
return handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return true && handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return true && handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,20 +213,20 @@ public class PickupHandler
|
|||
}
|
||||
}
|
||||
|
||||
if ((Settings.pickupHostileMobs.get() ? true : !toPickUp.isCreatureType(EnumCreatureType.MONSTER, false) || player.isCreative()))
|
||||
if ((Settings.pickupHostileMobs.get() ? true : toPickUp.getType().getClassification() != EntityClassification.MONSTER || player.isCreative()))
|
||||
{
|
||||
if ((Settings.pickupHostileMobs.get() ? true : !toPickUp.isCreatureType(EnumCreatureType.MONSTER, false) || player.isCreative()))
|
||||
if ((Settings.pickupHostileMobs.get() ? true : toPickUp.getType().getClassification() != EntityClassification.MONSTER || player.isCreative()))
|
||||
{
|
||||
if ((toPickUp.height <= Settings.maxEntityHeight.get() && toPickUp.width <= Settings.maxEntityWidth.get() || player.isCreative()))
|
||||
if ((toPickUp.getHeight() <= Settings.maxEntityHeight.get() && toPickUp.getWidth() <= Settings.maxEntityWidth.get() || player.isCreative()))
|
||||
{
|
||||
double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ);
|
||||
double distance = pos.distanceSq(player.getPosition());
|
||||
if (distance < Math.pow(Settings.maxDistance.get(), 2))
|
||||
{
|
||||
if (toPickUp instanceof EntityTameable)
|
||||
if (toPickUp instanceof TameableEntity)
|
||||
{
|
||||
EntityTameable tame = (EntityTameable) toPickUp;
|
||||
TameableEntity tame = (TameableEntity) toPickUp;
|
||||
UUID owner = tame.getOwnerId();
|
||||
UUID playerID = EntityPlayer.getUUID(player.getGameProfile());
|
||||
UUID playerID = PlayerEntity.getUUID(player.getGameProfile());
|
||||
if (owner != null && !owner.equals(playerID))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ public class PickupHandler
|
|||
Class<?> gameStageHelper = Class.forName("net.darkhax.gamestages.GameStageHelper");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.data.IStageData");
|
||||
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", EntityPlayer.class);
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", PlayerEntity.class);
|
||||
Method hasStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasStage", String.class);
|
||||
|
||||
Object stageData = getPlayerData.invoke(null, player);
|
||||
|
|
@ -246,7 +246,7 @@ public class PickupHandler
|
|||
boolean has = (boolean) hasStage.invoke(stageData, condition);
|
||||
|
||||
if (has)
|
||||
return handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -255,7 +255,7 @@ public class PickupHandler
|
|||
Class<?> playerDataHandler = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler$IStageData");
|
||||
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", EntityPlayer.class);
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", PlayerEntity.class);
|
||||
Method hasUnlockedStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasUnlockedStage", String.class);
|
||||
|
||||
Object stageData = getStageData.invoke(null, player);
|
||||
|
|
@ -263,16 +263,16 @@ public class PickupHandler
|
|||
boolean has = (boolean) hasUnlockedStage.invoke(stageData, condition);
|
||||
|
||||
if (has)
|
||||
return handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return true && handleProtections((EntityPlayerMP) player, toPickUp);
|
||||
return true && handleProtections((ServerPlayerEntity) player, toPickUp);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ public class PickupHandler
|
|||
return false;
|
||||
}
|
||||
|
||||
private static boolean handleProtections(EntityPlayerMP player, World world, BlockPos pos, IBlockState state)
|
||||
private static boolean handleProtections(ServerPlayerEntity player, World world, BlockPos pos, BlockState state)
|
||||
{
|
||||
boolean breakable = true;
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ public class PickupHandler
|
|||
return breakable;
|
||||
}
|
||||
|
||||
private static boolean handleProtections(EntityPlayerMP player, Entity entity)
|
||||
private static boolean handleProtections(ServerPlayerEntity player, Entity entity)
|
||||
{
|
||||
boolean canPickup = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import tschipp.carryon.common.capabilities.event.PositionCommonEvents;
|
|||
import tschipp.carryon.common.event.IMCEvents;
|
||||
import tschipp.carryon.common.event.ItemEntityEvents;
|
||||
import tschipp.carryon.common.event.ItemEvents;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.common.item.ItemCarryonEntity;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
import tschipp.carryon.compat.obfuscate.ObfuscateEvents;
|
||||
|
||||
@EventBusSubscriber(modid = CarryOn.MODID)
|
||||
|
|
@ -32,8 +32,8 @@ public class RegistrationHandler
|
|||
|
||||
public static void regItems()
|
||||
{
|
||||
itemTile = new ItemTile();
|
||||
itemEntity = new ItemEntity();
|
||||
itemTile = new ItemCarryonBlock();
|
||||
itemEntity = new ItemCarryonEntity();
|
||||
}
|
||||
|
||||
public static void regCommonEvents()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package tschipp.carryon.common.helper;
|
||||
package tschipp.carryon.common.helper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
@ -7,10 +7,10 @@ import java.util.Map;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.scoreboard.Score;
|
||||
import net.minecraft.scoreboard.ScoreObjective;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
|
|
@ -70,7 +70,7 @@ public class ScriptParseHelper
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean matches(NBTTagCompound toCheck, NBTTagCompound toMatch)
|
||||
public static boolean matches(CompoundNBT toCheck, CompoundNBT toMatch)
|
||||
{
|
||||
if (toCheck == null || toMatch == null)
|
||||
return true;
|
||||
|
|
@ -78,9 +78,9 @@ public class ScriptParseHelper
|
|||
boolean matching = true;
|
||||
for (String key : toMatch.keySet())
|
||||
{
|
||||
INBTBase tag = toMatch.getTag(key);
|
||||
INBT tag = toMatch.get(key);
|
||||
key = key.replace("\"", "");
|
||||
INBTBase tagToCheck = toCheck.getTag(key);
|
||||
INBT tagToCheck = toCheck.get(key);
|
||||
if (!tag.equals(tagToCheck))
|
||||
matching = false;
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ public class ScriptParseHelper
|
|||
return 1;
|
||||
}
|
||||
|
||||
public static boolean matchesScore(EntityPlayer player, String cond)
|
||||
public static boolean matchesScore(PlayerEntity player, String cond)
|
||||
{
|
||||
if (cond == null)
|
||||
return true;
|
||||
|
|
@ -216,12 +216,12 @@ public class ScriptParseHelper
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static boolean hasEffects(EntityPlayer player, String cond)
|
||||
public static boolean hasEffects(PlayerEntity player, String cond)
|
||||
{
|
||||
if(cond == null)
|
||||
return true;
|
||||
|
||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||
Collection<EffectInstance> effects = player.getActivePotionEffects();
|
||||
String[] potions = cond.split(",");
|
||||
|
||||
List<String> names = new ArrayList<String>();
|
||||
|
|
@ -254,7 +254,7 @@ public class ScriptParseHelper
|
|||
}
|
||||
|
||||
int matches = 0;
|
||||
for(PotionEffect effect : effects)
|
||||
for(EffectInstance effect : effects)
|
||||
{
|
||||
int amp = effect.getAmplifier();
|
||||
String name = effect.getPotion().getRegistryName().toString();
|
||||
|
|
@ -291,12 +291,10 @@ public class ScriptParseHelper
|
|||
return material == Material.CAKE;
|
||||
case "carpet":
|
||||
return material == Material.CARPET;
|
||||
case "circuits":
|
||||
return material == Material.CIRCUITS;
|
||||
case "clay":
|
||||
return material == Material.CLAY;
|
||||
case "cloth":
|
||||
return material == Material.CLOTH;
|
||||
return material == Material.WOOL;
|
||||
case "coral":
|
||||
return material == Material.CORAL;
|
||||
case "dragon_egg":
|
||||
|
|
@ -308,9 +306,9 @@ public class ScriptParseHelper
|
|||
case "gourd":
|
||||
return material == Material.GOURD;
|
||||
case "grass":
|
||||
return material == Material.GRASS;
|
||||
return material == Material.ORGANIC;
|
||||
case "ground":
|
||||
return material == Material.GROUND;
|
||||
return material == Material.ORGANIC;
|
||||
case "ice":
|
||||
return material == Material.ICE;
|
||||
case "iron":
|
||||
|
|
@ -342,7 +340,7 @@ public class ScriptParseHelper
|
|||
case "tnt":
|
||||
return material == Material.TNT;
|
||||
case "vine":
|
||||
return material == Material.VINE;
|
||||
return material == Material.PLANTS;
|
||||
case "water":
|
||||
return material == Material.WATER;
|
||||
case "web":
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import javax.annotation.Nullable;
|
|||
import com.mojang.brigadier.StringReader;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.arguments.BlockStateParser;
|
||||
import net.minecraft.command.arguments.ItemParser;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class StringParser
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@ public class StringParser
|
|||
@Nullable
|
||||
public static Block getBlock(String string)
|
||||
{
|
||||
IBlockState state = getBlockState(string);
|
||||
BlockState state = getBlockState(string);
|
||||
if(state != null)
|
||||
return state.getBlock();
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ public class StringParser
|
|||
|
||||
|
||||
@Nullable
|
||||
public static IBlockState getBlockState(String string)
|
||||
public static BlockState getBlockState(String string)
|
||||
{
|
||||
if(string == null)
|
||||
return null;
|
||||
|
|
@ -78,7 +78,7 @@ public class StringParser
|
|||
{
|
||||
parser.parse();
|
||||
Item item = parser.getItem();
|
||||
NBTTagCompound nbt = parser.getNbt();
|
||||
CompoundNBT nbt = parser.getNbt();
|
||||
|
||||
ItemStack stack = new ItemStack(item, 1);
|
||||
|
||||
|
|
@ -99,9 +99,9 @@ public class StringParser
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public static NBTTagCompound getTagCompound(String string)
|
||||
public static CompoundNBT getTagCompound(String string)
|
||||
{
|
||||
NBTTagCompound tag = null;
|
||||
CompoundNBT tag = null;
|
||||
if(string == null)
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,33 +7,33 @@ import javax.annotation.Nullable;
|
|||
import com.google.common.base.CharMatcher;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.ClickEvent.Action;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.event.world.BlockEvent.PlaceEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
|
|
@ -42,13 +42,13 @@ import tschipp.carryon.common.event.ItemEvents;
|
|||
import tschipp.carryon.common.handler.CustomPickupOverrideHandler;
|
||||
import tschipp.carryon.common.handler.ModelOverridesHandler;
|
||||
|
||||
public class ItemTile extends Item
|
||||
public class ItemCarryonBlock extends Item
|
||||
{
|
||||
|
||||
public static final String TILE_DATA_KEY = "tileData";
|
||||
public static final String[] FACING_KEYS = new String[] { "rotation", "rot", "facing", "face", "direction", "dir", "front", "forward" };
|
||||
|
||||
public ItemTile()
|
||||
public ItemCarryonBlock()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1));
|
||||
this.setRegistryName(CarryOn.MODID, "tile_item");
|
||||
|
|
@ -59,8 +59,8 @@ public class ItemTile extends Item
|
|||
{
|
||||
if (hasTileData(stack))
|
||||
{
|
||||
IBlockState state = getBlockState(stack);
|
||||
NBTTagCompound nbt = getTileData(stack);
|
||||
BlockState state = getBlockState(stack);
|
||||
CompoundNBT nbt = getTileData(stack);
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(state, nbt))
|
||||
{
|
||||
|
|
@ -69,7 +69,7 @@ public class ItemTile extends Item
|
|||
return ((ItemStack) override).getDisplayName();
|
||||
else
|
||||
{
|
||||
IBlockState ostate = (IBlockState) override;
|
||||
BlockState ostate = (BlockState) override;
|
||||
return ostate.getBlock().getNameTextComponent();
|
||||
}
|
||||
}
|
||||
|
|
@ -77,14 +77,15 @@ public class ItemTile extends Item
|
|||
return getItemStack(stack).getDisplayName();
|
||||
}
|
||||
|
||||
return new TextComponentString("");
|
||||
return new StringTextComponent("");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemUseContext context)
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
EnumFacing facing = context.getFace();
|
||||
EntityPlayer player = context.getPlayer();
|
||||
Direction facing = context.getFace();
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
ItemStack stack = context.getItem();
|
||||
|
|
@ -92,7 +93,7 @@ public class ItemTile extends Item
|
|||
if (ModList.get().isLoaded("betterplacement"))
|
||||
{
|
||||
if (CarryOnKeybinds.isKeyPressed(player))
|
||||
return EnumActionResult.FAIL;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if (hasTileData(stack))
|
||||
|
|
@ -100,10 +101,10 @@ public class ItemTile extends Item
|
|||
try
|
||||
{
|
||||
Vec3d vec = player.getLookVec();
|
||||
EnumFacing facing2 = EnumFacing.getFacingFromVector((float) vec.x, 0f, (float) vec.z);
|
||||
Direction facing2 = Direction.getFacingFromVector((float) vec.x, 0f, (float) vec.z);
|
||||
BlockPos pos2 = pos;
|
||||
Block containedblock = getBlock(stack);
|
||||
IBlockState containedstate = getBlockState(stack);
|
||||
BlockState containedstate = getBlockState(stack);
|
||||
if (!world.getBlockState(pos2).isReplaceable(new BlockItemUseContext(context)))
|
||||
{
|
||||
pos2 = pos.offset(facing);
|
||||
|
|
@ -118,9 +119,9 @@ public class ItemTile extends Item
|
|||
if (player.canPlayerEdit(pos, facing, stack) && world.isBlockModifiable(player, pos2))
|
||||
{
|
||||
|
||||
IBlockState actualState = containedblock.getStateForPlacement(new BlockItemUseContext(context));
|
||||
BlockState actualState = containedblock.getStateForPlacement(new BlockItemUseContext(context));
|
||||
BlockSnapshot snapshot = new BlockSnapshot(world, pos2, containedstate);
|
||||
PlaceEvent event = new PlaceEvent(snapshot, world.getBlockState(pos), player, EnumHand.MAIN_HAND);
|
||||
EntityPlaceEvent event = new EntityPlaceEvent(snapshot, world.getBlockState(pos), player);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
if (!event.isCanceled())
|
||||
|
|
@ -132,7 +133,7 @@ public class ItemTile extends Item
|
|||
// change rotation via NBT
|
||||
if (!getTileData(stack).isEmpty())
|
||||
{
|
||||
NBTTagCompound tag = getTileData(stack);
|
||||
CompoundNBT tag = getTileData(stack);
|
||||
Set<String> keys = tag.keySet();
|
||||
keytester: for (String key : keys)
|
||||
{
|
||||
|
|
@ -144,13 +145,13 @@ public class ItemTile extends Item
|
|||
switch (type)
|
||||
{
|
||||
case 8:
|
||||
tag.setString(key, CharMatcher.javaUpperCase().matchesAllOf(tag.getString(key)) ? facing2.getOpposite().getName().toUpperCase() : facing2.getOpposite().getName());
|
||||
tag.putString(key, CharMatcher.javaUpperCase().matchesAllOf(tag.getString(key)) ? facing2.getOpposite().getName().toUpperCase() : facing2.getOpposite().getName());
|
||||
break;
|
||||
case 3:
|
||||
tag.setInt(key, facing2.getOpposite().getIndex());
|
||||
tag.putInt(key, facing2.getOpposite().getIndex());
|
||||
break;
|
||||
case 1:
|
||||
tag.setByte(key, (byte) facing2.getOpposite().getIndex());
|
||||
tag.putByte(key, (byte) facing2.getOpposite().getIndex());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -170,10 +171,10 @@ public class ItemTile extends Item
|
|||
}
|
||||
clearTileData(stack);
|
||||
player.playSound(actualState.getSoundType(world, pos2, player).getPlaceSound(), 1.0f, 0.5f);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
player.getEntityData().removeTag("overrideKey");
|
||||
player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
|
||||
player.getEntityData().remove("overrideKey");
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -186,28 +187,28 @@ public class ItemTile extends Item
|
|||
|
||||
if (world != null && world.isRemote)
|
||||
{
|
||||
CarryOn.LOGGER.info("Block: " + ItemTile.getBlock(stack));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemTile.getBlockState(stack));
|
||||
CarryOn.LOGGER.info("Block: " + ItemCarryonBlock.getBlock(stack));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemCarryonBlock.getBlockState(stack));
|
||||
// CarryOn.LOGGER.info("Meta: " + ItemTile.getMeta(stack));
|
||||
CarryOn.LOGGER.info("ItemStack: " + ItemTile.getItemStack(stack));
|
||||
CarryOn.LOGGER.info("ItemStack: " + ItemCarryonBlock.getItemStack(stack));
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemTile.getBlockState(stack), ItemTile.getTileData(stack)))
|
||||
CarryOn.LOGGER.info("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemTile.getBlockState(stack), ItemTile.getTileData(stack)));
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemCarryonBlock.getBlockState(stack), ItemCarryonBlock.getTileData(stack)))
|
||||
CarryOn.LOGGER.info("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemCarryonBlock.getBlockState(stack), ItemCarryonBlock.getTileData(stack)));
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemTile.getBlockState(stack)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemTile.getBlockState(stack)));
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonBlock.getBlockState(stack)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonBlock.getBlockState(stack)));
|
||||
|
||||
player.sendMessage(new TextComponentString(TextFormatting.RED + "Error detected. Cannot place block. Execute \"/carryon clear\" to remove the item"));
|
||||
TextComponentString s = new TextComponentString(TextFormatting.GOLD + "here");
|
||||
player.sendMessage(new StringTextComponent(TextFormatting.RED + "Error detected. Cannot place block. Execute \"/carryon clear\" to remove the item"));
|
||||
StringTextComponent s = new StringTextComponent(TextFormatting.GOLD + "here");
|
||||
s.getStyle().setClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
|
||||
player.sendMessage(new TextComponentString(TextFormatting.RED + "Please report this error ").appendSibling(s));
|
||||
player.sendMessage(new StringTextComponent(TextFormatting.RED + "Please report this error ").appendSibling(s));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return EnumActionResult.FAIL;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -215,12 +216,12 @@ public class ItemTile extends Item
|
|||
{
|
||||
if (hasTileData(stack))
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
if (entity instanceof EntityPlayer && Settings.slownessInCreative.get() ? false : ((EntityPlayer) entity).isCreative())
|
||||
if (entity instanceof PlayerEntity && Settings.slownessInCreative.get() ? false : ((PlayerEntity) entity).isCreative())
|
||||
return;
|
||||
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 1, potionLevel(stack), false, false));
|
||||
((LivingEntity) entity).addPotionEffect(new EffectInstance(Effects.SLOWNESS, 1, potionLevel(stack), false, false));
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
|
@ -232,33 +233,33 @@ public class ItemTile extends Item
|
|||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
return tag.hasKey(TILE_DATA_KEY) && tag.hasKey("block") && tag.hasKey("stateid");
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.contains(TILE_DATA_KEY) && tag.contains("block") && tag.contains("stateid");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean storeTileData(@Nullable TileEntity tile, World world, BlockPos pos, IBlockState state, ItemStack stack)
|
||||
public static boolean storeTileData(@Nullable TileEntity tile, World world, BlockPos pos, BlockState state, ItemStack stack)
|
||||
{
|
||||
if (stack.isEmpty())
|
||||
return false;
|
||||
|
||||
NBTTagCompound chest = new NBTTagCompound();
|
||||
CompoundNBT chest = new CompoundNBT();
|
||||
if (tile != null)
|
||||
chest = tile.write(chest);
|
||||
|
||||
NBTTagCompound tag = stack.hasTag() ? stack.getTag() : new NBTTagCompound();
|
||||
if (tag.hasKey(TILE_DATA_KEY))
|
||||
CompoundNBT tag = stack.hasTag() ? stack.getTag() : new CompoundNBT();
|
||||
if (tag.contains(TILE_DATA_KEY))
|
||||
return false;
|
||||
|
||||
tag.setTag(TILE_DATA_KEY, chest);
|
||||
tag.put(TILE_DATA_KEY, chest);
|
||||
|
||||
// ItemStack drop = new ItemStack(state.getBlock().getItemDropped(state, itemRand, 0), 1, state.getBlock().damageDropped(state));
|
||||
|
||||
tag.setString("block", state.getBlock().getRegistryName().toString());
|
||||
tag.putString("block", state.getBlock().getRegistryName().toString());
|
||||
// Item item = Item.getItemFromBlock(state.getBlock());
|
||||
// tag.setInt("meta", drop.getItemDamage());
|
||||
tag.setInt("stateid", Block.getStateId(state));
|
||||
tag.putInt("stateid", Block.getStateId(state));
|
||||
stack.setTag(tag);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -267,18 +268,18 @@ public class ItemTile extends Item
|
|||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
tag.removeTag(TILE_DATA_KEY);
|
||||
tag.removeTag("block");
|
||||
tag.removeTag("stateid");
|
||||
CompoundNBT tag = stack.getTag();
|
||||
tag.remove(TILE_DATA_KEY);
|
||||
tag.remove("block");
|
||||
tag.remove("stateid");
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound getTileData(ItemStack stack)
|
||||
public static CompoundNBT getTileData(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getCompound(TILE_DATA_KEY);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -288,7 +289,7 @@ public class ItemTile extends Item
|
|||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
CompoundNBT tag = stack.getTag();
|
||||
int id = tag.getInt("stateid");
|
||||
return Block.getStateById(id).getBlock();
|
||||
}
|
||||
|
|
@ -299,7 +300,7 @@ public class ItemTile extends Item
|
|||
// {
|
||||
// if (stack.hasTag())
|
||||
// {
|
||||
// NBTTagCompound tag = stack.getTag();
|
||||
// CompoundNBT tag = stack.getTag();
|
||||
// int meta = tag.getInt("meta");
|
||||
// return meta;
|
||||
// }
|
||||
|
|
@ -311,11 +312,11 @@ public class ItemTile extends Item
|
|||
return new ItemStack(getBlock(stack), 1);
|
||||
}
|
||||
|
||||
public static IBlockState getBlockState(ItemStack stack)
|
||||
public static BlockState getBlockState(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
CompoundNBT tag = stack.getTag();
|
||||
int id = tag.getInt("stateid");
|
||||
return Block.getStateById(id);
|
||||
}
|
||||
|
|
@ -327,9 +328,9 @@ public class ItemTile extends Item
|
|||
TileEntity te = world.getTileEntity(pos);
|
||||
if (te != null)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
te.write(tag);
|
||||
return tag.hasKey("Lock") ? !tag.getString("Lock").equals("") : false;
|
||||
return tag.contains("Lock") ? !tag.getString("Lock").equals("") : false;
|
||||
}
|
||||
|
||||
return false;
|
||||
232
src/main/java/tschipp/carryon/common/item/ItemCarryonEntity.java
Normal file
232
src/main/java/tschipp/carryon/common/item/ItemCarryonEntity.java
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
package tschipp.carryon.common.item;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.event.ItemEvents;
|
||||
|
||||
public class ItemCarryonEntity extends Item {
|
||||
|
||||
public static final String ENTITY_DATA_KEY = "entityData";
|
||||
|
||||
public ItemCarryonEntity() {
|
||||
super(new Item.Properties().maxStackSize(1));
|
||||
this.setRegistryName(CarryOn.MODID, "entity_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(ItemStack stack)
|
||||
{
|
||||
if (hasEntityData(stack)) {
|
||||
|
||||
return new TranslationTextComponent(getEntityType(stack).getTranslationKey());
|
||||
}
|
||||
|
||||
return new StringTextComponent("");
|
||||
}
|
||||
|
||||
public static boolean hasEntityData(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.contains(ENTITY_DATA_KEY) && tag.contains("entity");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean storeEntityData(@Nonnull Entity entity, World world, ItemStack stack) {
|
||||
if (entity == null)
|
||||
return false;
|
||||
|
||||
if (stack.isEmpty())
|
||||
return false;
|
||||
|
||||
CompoundNBT entityData = new CompoundNBT();
|
||||
entityData = entity.serializeNBT();
|
||||
|
||||
String name = EntityType.getKey(entity.getType()).toString();
|
||||
|
||||
CompoundNBT tag = stack.hasTag() ? stack.getTag() : new CompoundNBT();
|
||||
if (tag.contains(ENTITY_DATA_KEY))
|
||||
return false;
|
||||
|
||||
tag.put(ENTITY_DATA_KEY, entityData);
|
||||
tag.putString("entity", name);
|
||||
stack.setTag(tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context) {
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
Direction facing = context.getFace();
|
||||
|
||||
ItemStack stack = context.getItem();
|
||||
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
||||
if (ModList.get().isLoaded("betterplacement")) {
|
||||
if (CarryOnKeybinds.isKeyPressed(player))
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if (hasEntityData(stack)) {
|
||||
BlockPos finalPos = pos;
|
||||
|
||||
if (!state.isReplaceable(new BlockItemUseContext(context))) {
|
||||
finalPos = pos.offset(facing);
|
||||
}
|
||||
|
||||
Entity entity = getEntity(stack, world);
|
||||
if (entity != null) {
|
||||
if (!world.isRemote) {
|
||||
entity.setPositionAndRotation(finalPos.getX() + 0.5, finalPos.getY(), finalPos.getZ() + 0.5,
|
||||
180 + player.rotationYawHead, 0.0f);
|
||||
world.addEntity(entity);
|
||||
if (entity instanceof MobEntity) {
|
||||
((MobEntity) entity).playAmbientSound();
|
||||
}
|
||||
clearEntityData(stack);
|
||||
player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
|
||||
}
|
||||
player.getEntityData().remove("overrideKey");
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||
if (hasEntityData(stack)) {
|
||||
if (getEntity(stack, world) == null)
|
||||
stack = ItemStack.EMPTY;
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
if (entity instanceof PlayerEntity && Settings.slownessInCreative.get() ? false
|
||||
: ((PlayerEntity) entity).isCreative())
|
||||
return;
|
||||
|
||||
((LivingEntity) entity).addPotionEffect(
|
||||
new EffectInstance(Effects.SLOWNESS, 1, potionLevel(stack, world), false, false));
|
||||
}
|
||||
|
||||
} else {
|
||||
stack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearEntityData(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
tag.remove(ENTITY_DATA_KEY);
|
||||
tag.remove("entity");
|
||||
}
|
||||
}
|
||||
|
||||
public static CompoundNBT getEntityData(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getCompound(ENTITY_DATA_KEY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Entity getEntity(ItemStack stack, World world) {
|
||||
if (world == null)
|
||||
return null;
|
||||
|
||||
String name = getEntityName(stack);
|
||||
|
||||
CompoundNBT e = getEntityData(stack);
|
||||
Optional<EntityType<?>> type = EntityType.byKey(name);
|
||||
Entity entity = null;
|
||||
|
||||
if (type.isPresent()) {
|
||||
entity = type.get().create(world);
|
||||
}
|
||||
|
||||
if (entity != null)
|
||||
entity.deserializeNBT(e);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static String getEntityName(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getString("entity");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getCustomName(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
if (tag.contains("CustomName") && !tag.getString("CustomName").isEmpty()) {
|
||||
return tag.toString();
|
||||
} else {
|
||||
return tag.toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EntityType<?> getEntityType(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
String name = tag.getString("entity");
|
||||
Optional<EntityType<?>> type = EntityType.byKey(name);
|
||||
if (type.isPresent())
|
||||
return type.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int potionLevel(ItemStack stack, World world) {
|
||||
Entity e = getEntity(stack, world);
|
||||
if (e == null)
|
||||
return 1;
|
||||
|
||||
int i = (int) (e.getHeight() * e.getWidth());
|
||||
if (i > 4)
|
||||
i = 4;
|
||||
|
||||
if (!Settings.heavyEntities.get())
|
||||
i = 1;
|
||||
|
||||
double multiplier = Settings.entitySlownessMultiplier.get();
|
||||
|
||||
return (int) (multiplier * i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,248 +0,0 @@
|
|||
package tschipp.carryon.common.item;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.event.ItemEvents;
|
||||
|
||||
public class ItemEntity extends Item
|
||||
{
|
||||
|
||||
public static final String ENTITY_DATA_KEY = "entityData";
|
||||
|
||||
public ItemEntity()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1));
|
||||
this.setRegistryName(CarryOn.MODID, "entity_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(ItemStack stack)
|
||||
{
|
||||
if (hasEntityData(stack)) {
|
||||
|
||||
return new TextComponentTranslation(getEntityType(stack).getTranslationKey());
|
||||
}
|
||||
|
||||
return new TextComponentString("");
|
||||
}
|
||||
|
||||
public static boolean hasEntityData(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
return tag.hasKey(ENTITY_DATA_KEY) && tag.hasKey("entity");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean storeEntityData(@Nonnull Entity entity, World world, ItemStack stack)
|
||||
{
|
||||
if (entity == null)
|
||||
return false;
|
||||
|
||||
if (stack.isEmpty())
|
||||
return false;
|
||||
|
||||
NBTTagCompound entityData = new NBTTagCompound();
|
||||
entityData = entity.serializeNBT();
|
||||
|
||||
String name = EntityType.getId(entity.getType()).toString();
|
||||
|
||||
NBTTagCompound tag = stack.hasTag() ? stack.getTag() : new NBTTagCompound();
|
||||
if (tag.hasKey(ENTITY_DATA_KEY))
|
||||
return false;
|
||||
|
||||
tag.setTag(ENTITY_DATA_KEY, entityData);
|
||||
tag.setString("entity", name);
|
||||
stack.setTag(tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemUseContext context)
|
||||
{
|
||||
EntityPlayer player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
EnumFacing facing = context.getFace();
|
||||
|
||||
ItemStack stack = context.getItem();
|
||||
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if(ModList.get().isLoaded("betterplacement"))
|
||||
{
|
||||
if(CarryOnKeybinds.isKeyPressed(player))
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (hasEntityData(stack))
|
||||
{
|
||||
BlockPos finalPos = pos;
|
||||
|
||||
if (!state.isReplaceable(new BlockItemUseContext(context)))
|
||||
{
|
||||
finalPos = pos.offset(facing);
|
||||
}
|
||||
|
||||
Entity entity = getEntity(stack, world);
|
||||
if (entity != null)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPositionAndRotation(finalPos.getX() + 0.5, finalPos.getY(), finalPos.getZ() + 0.5, 180 + player.rotationYawHead, 0.0f);
|
||||
world.spawnEntity(entity);
|
||||
if (entity instanceof EntityLiving)
|
||||
{
|
||||
((EntityLiving) entity).playAmbientSound();
|
||||
}
|
||||
clearEntityData(stack);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
|
||||
}
|
||||
player.getEntityData().removeTag("overrideKey");
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (hasEntityData(stack))
|
||||
{
|
||||
if(getEntity(stack, world) == null)
|
||||
stack = ItemStack.EMPTY;
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if(entity instanceof EntityPlayer && Settings.slownessInCreative.get() ? false : ((EntityPlayer)entity).isCreative())
|
||||
return;
|
||||
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 1, potionLevel(stack, world), false, false));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
stack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearEntityData(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
tag.removeTag(ENTITY_DATA_KEY);
|
||||
tag.removeTag("entity");
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound getEntityData(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
return tag.getCompound(ENTITY_DATA_KEY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Entity getEntity(ItemStack stack, World world)
|
||||
{
|
||||
if (world == null)
|
||||
return null;
|
||||
|
||||
String name = getEntityName(stack);
|
||||
|
||||
NBTTagCompound e = getEntityData(stack);
|
||||
Entity entity = EntityType.create(world, new ResourceLocation(name));
|
||||
if (entity != null)
|
||||
entity.deserializeNBT(e);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static String getEntityName(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
return tag.getString("entity");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getCustomName(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
if (tag.hasKey("CustomName") && !tag.getString("CustomName").isEmpty()) {
|
||||
return tag.toString();
|
||||
} else {
|
||||
return tag.toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EntityType<?> getEntityType(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
NBTTagCompound tag = stack.getTag();
|
||||
String name = tag.getString("entity");
|
||||
EntityType<?> type = EntityType.getById(name);
|
||||
return type;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int potionLevel(ItemStack stack, World world)
|
||||
{
|
||||
Entity e = getEntity(stack, world);
|
||||
if(e == null)
|
||||
return 1;
|
||||
|
||||
int i = (int)(e.height * e.width);
|
||||
if (i > 4)
|
||||
i = 4;
|
||||
|
||||
if (!Settings.heavyEntities.get())
|
||||
i = 1;
|
||||
|
||||
double multiplier = Settings.entitySlownessMultiplier.get();
|
||||
|
||||
return (int) (multiplier * i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
package tschipp.carryon.common.scripting;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
public class CarryOnOverride
|
||||
{
|
||||
// BLOCKS
|
||||
private NBTTagCompound typeBlockTag;
|
||||
private CompoundNBT typeBlockTag;
|
||||
private String typeNameBlock;
|
||||
private String typeMaterial;
|
||||
private String typeHardness;
|
||||
private String typeResistance;
|
||||
|
||||
// ENTITIES
|
||||
private NBTTagCompound typeEntityTag;
|
||||
private CompoundNBT typeEntityTag;
|
||||
private String typeNameEntity;
|
||||
private String typeHeight;
|
||||
private String typeWidth;
|
||||
|
|
@ -30,7 +30,7 @@ public class CarryOnOverride
|
|||
// RENDER
|
||||
private String renderNameBlock;
|
||||
private String renderNameEntity;
|
||||
private NBTTagCompound renderNBT;
|
||||
private CompoundNBT renderNBT;
|
||||
private String renderTranslation;
|
||||
private String renderRotation;
|
||||
private String renderscaled;
|
||||
|
|
@ -387,7 +387,7 @@ public class CarryOnOverride
|
|||
this.isEntity = isEntity;
|
||||
}
|
||||
|
||||
public NBTTagCompound getTypeBlockTag()
|
||||
public CompoundNBT getTypeBlockTag()
|
||||
{
|
||||
return typeBlockTag;
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ public class CarryOnOverride
|
|||
return typeResistance;
|
||||
}
|
||||
|
||||
public NBTTagCompound getTypeEntityTag()
|
||||
public CompoundNBT getTypeEntityTag()
|
||||
{
|
||||
return typeEntityTag;
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ public class CarryOnOverride
|
|||
return renderNameEntity;
|
||||
}
|
||||
|
||||
public NBTTagCompound getRenderNBT()
|
||||
public CompoundNBT getRenderNBT()
|
||||
{
|
||||
return renderNBT;
|
||||
}
|
||||
|
|
@ -497,7 +497,7 @@ public class CarryOnOverride
|
|||
return renderscaled;
|
||||
}
|
||||
|
||||
public void setTypeBlockTag(NBTTagCompound typeBlockTag)
|
||||
public void setTypeBlockTag(CompoundNBT typeBlockTag)
|
||||
{
|
||||
this.typeBlockTag = typeBlockTag;
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@ public class CarryOnOverride
|
|||
this.typeResistance = typeResistance;
|
||||
}
|
||||
|
||||
public void setTypeEntityTag(NBTTagCompound typeEntityTag)
|
||||
public void setTypeEntityTag(CompoundNBT typeEntityTag)
|
||||
{
|
||||
this.typeEntityTag = typeEntityTag;
|
||||
}
|
||||
|
|
@ -588,7 +588,7 @@ public class CarryOnOverride
|
|||
this.renderNameEntity = renderNameEntity;
|
||||
}
|
||||
|
||||
public void setRenderNBT(NBTTagCompound renderNBT)
|
||||
public void setRenderNBT(CompoundNBT renderNBT)
|
||||
{
|
||||
this.renderNBT = renderNBT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ import javax.annotation.Nullable;
|
|||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
|
@ -26,7 +26,7 @@ import tschipp.carryon.common.helper.ScriptParseHelper;
|
|||
public class ScriptChecker
|
||||
{
|
||||
@Nullable
|
||||
public static CarryOnOverride inspectBlock(IBlockState state, World world, BlockPos pos, @Nullable NBTTagCompound tag)
|
||||
public static CarryOnOverride inspectBlock(BlockState state, World world, BlockPos pos, @Nullable CompoundNBT tag)
|
||||
{
|
||||
if (!Settings.useScripts.get())
|
||||
return null;
|
||||
|
|
@ -36,7 +36,7 @@ public class ScriptChecker
|
|||
float hardness = state.getBlockHardness(world, pos);
|
||||
@SuppressWarnings("deprecation")
|
||||
float resistance = block.getExplosionResistance();
|
||||
NBTTagCompound nbt = tag;
|
||||
CompoundNBT nbt = tag;
|
||||
|
||||
boolean isAllowed = Settings.useWhitelistBlocks.get() ? ListHandler.isAllowed(block) : !ListHandler.isForbidden(block);
|
||||
|
||||
|
|
@ -62,10 +62,10 @@ public class ScriptChecker
|
|||
return null;
|
||||
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
float height = entity.height;
|
||||
float width = entity.width;
|
||||
float health = entity instanceof EntityLivingBase ? ((EntityLivingBase) entity).getHealth() : 0.0f;
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
float height = entity.getHeight();
|
||||
float width = entity.getWidth();
|
||||
float health = entity instanceof LivingEntity ? ((LivingEntity) entity).getHealth() : 0.0f;
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
entity.deserializeNBT(tag);
|
||||
|
||||
boolean isAllowed = Settings.useWhitelistEntities.get() ? ListHandler.isAllowed(entity) : !ListHandler.isForbidden(entity);
|
||||
|
|
@ -85,7 +85,7 @@ public class ScriptChecker
|
|||
return null;
|
||||
}
|
||||
|
||||
public static boolean matchesAll(CarryOnOverride override, String name, float height, float width, float health, NBTTagCompound tag)
|
||||
public static boolean matchesAll(CarryOnOverride override, String name, float height, float width, float health, CompoundNBT tag)
|
||||
{
|
||||
boolean matchname = override.getTypeNameEntity() == null ? true : name.equals(override.getTypeNameEntity());
|
||||
boolean matchheight = ScriptParseHelper.matches(height, override.getTypeHeight());
|
||||
|
|
@ -96,7 +96,7 @@ public class ScriptChecker
|
|||
return (matchname && matchheight && matchwidth && matchhealth && matchnbt);
|
||||
}
|
||||
|
||||
public static boolean matchesAll(CarryOnOverride override, Block block, Material material, float hardness, float resistance, NBTTagCompound nbt)
|
||||
public static boolean matchesAll(CarryOnOverride override, Block block, Material material, float hardness, float resistance, CompoundNBT nbt)
|
||||
{
|
||||
boolean matchnbt = ScriptParseHelper.matches(nbt, override.getTypeBlockTag());
|
||||
boolean matchblock = ScriptParseHelper.matches(block, override.getTypeNameBlock());
|
||||
|
|
@ -107,13 +107,13 @@ public class ScriptChecker
|
|||
return (matchnbt && matchblock && matchmaterial && matchhardness && matchresistance);
|
||||
}
|
||||
|
||||
public static boolean fulfillsConditions(CarryOnOverride override, EntityPlayer player)
|
||||
public static boolean fulfillsConditions(CarryOnOverride override, PlayerEntity player)
|
||||
{
|
||||
AdvancementManager manager = ((EntityPlayerMP) player).server.getAdvancementManager();
|
||||
AdvancementManager manager = ((ServerPlayerEntity) player).server.getAdvancementManager();
|
||||
Advancement adv = manager.getAdvancement(new ResourceLocation((override.getConditionAchievement()) == null ? "" : override.getConditionAchievement()));
|
||||
|
||||
boolean achievement = adv == null ? true : ((EntityPlayerMP) player).getAdvancements().getProgress(adv).isDone();
|
||||
boolean gamemode = ScriptParseHelper.matches(((EntityPlayerMP) player).interactionManager.getGameType().getID(), override.getConditionGamemode());
|
||||
boolean achievement = adv == null ? true : ((ServerPlayerEntity) player).getAdvancements().getProgress(adv).isDone();
|
||||
boolean gamemode = ScriptParseHelper.matches(((ServerPlayerEntity) player).interactionManager.getGameType().getID(), override.getConditionGamemode());
|
||||
boolean gamestage = true;
|
||||
if (ModList.get().isLoaded("gamestages"))
|
||||
{
|
||||
|
|
@ -124,7 +124,7 @@ public class ScriptChecker
|
|||
Class<?> gameStageHelper = Class.forName("net.darkhax.gamestages.GameStageHelper");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.data.IStageData");
|
||||
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", EntityPlayer.class);
|
||||
Method getPlayerData = ObfuscationReflectionHelper.findMethod(gameStageHelper, "getPlayerData", PlayerEntity.class);
|
||||
Method hasStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasStage", String.class);
|
||||
|
||||
Object stageData = getPlayerData.invoke(null, player);
|
||||
|
|
@ -138,7 +138,7 @@ public class ScriptChecker
|
|||
Class<?> playerDataHandler = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler");
|
||||
Class<?> iStageData = Class.forName("net.darkhax.gamestages.capabilities.PlayerDataHandler$IStageData");
|
||||
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", EntityPlayer.class);
|
||||
Method getStageData = ObfuscationReflectionHelper.findMethod(playerDataHandler, "getStageData", PlayerEntity.class);
|
||||
Method hasUnlockedStage = ObfuscationReflectionHelper.findMethod(iStageData, "hasUnlockedStage", String.class);
|
||||
|
||||
Object stageData = getStageData.invoke(null, player);
|
||||
|
|
@ -163,11 +163,11 @@ public class ScriptChecker
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public static CarryOnOverride getOverride(EntityPlayer player)
|
||||
public static CarryOnOverride getOverride(PlayerEntity player)
|
||||
{
|
||||
NBTTagCompound tag = player.getEntityData();
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
|
||||
if (tag != null && tag.hasKey("overrideKey"))
|
||||
if (tag != null && tag.contains("overrideKey"))
|
||||
{
|
||||
int key = tag.getInt("overrideKey");
|
||||
|
||||
|
|
@ -177,12 +177,12 @@ public class ScriptChecker
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void setCarryOnOverride(EntityPlayer player, int i)
|
||||
public static void setCarryOnOverride(PlayerEntity player, int i)
|
||||
{
|
||||
NBTTagCompound tag = player.getEntityData();
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
|
||||
if (tag != null)
|
||||
tag.setInt("overrideKey", i);
|
||||
tag.putInt("overrideKey", i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class ObfuscateEvents
|
|||
// if(!CarryOnConfig.settings.renderArms.get())
|
||||
// return;
|
||||
//
|
||||
// EntityPlayer player = event.getEntityPlayer();
|
||||
// PlayerEntity player = event.getPlayerEntity();
|
||||
//
|
||||
// ModelPlayer model = event.getModelPlayer();
|
||||
// ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.function.Supplier;
|
|||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import tschipp.carryon.CarryOn;
|
||||
|
|
@ -53,20 +53,20 @@ public class CarrySlotPacket
|
|||
{
|
||||
Entity e = world.getEntityByID(entityid);
|
||||
|
||||
if (e != null && e instanceof EntityPlayer)
|
||||
if (e != null && e instanceof PlayerEntity)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
PlayerEntity player = (PlayerEntity) e;
|
||||
|
||||
ctx.get().setPacketHandled(true);
|
||||
|
||||
if (slot >= 9)
|
||||
{
|
||||
player.getEntityData().removeTag("carrySlot");
|
||||
player.getEntityData().removeTag("overrideKey");
|
||||
player.getEntityData().remove("carrySlot");
|
||||
player.getEntityData().remove("overrideKey");
|
||||
} else
|
||||
{
|
||||
|
||||
player.getEntityData().setInt("carrySlot", slot);
|
||||
player.getEntityData().putInt("carrySlot", slot);
|
||||
if (carryOverride != 0)
|
||||
ScriptChecker.setCarryOnOverride(player, carryOverride);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package tschipp.carryon.network.client;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.common.scripting.ScriptReader;
|
||||
|
|
@ -27,7 +27,7 @@ public class ScriptReloadPacket
|
|||
{
|
||||
ctx.get().enqueueWork(() -> {
|
||||
|
||||
EntityPlayer player = CarryOn.proxy.getPlayer();
|
||||
PlayerEntity player = CarryOn.proxy.getPlayer();
|
||||
|
||||
if (player != null)
|
||||
ScriptReader.reloadScripts();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package tschipp.carryon.network.server;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ public class SyncKeybindPacket
|
|||
{
|
||||
ctx.get().enqueueWork(() -> {
|
||||
|
||||
EntityPlayerMP player = ctx.get().getSender();
|
||||
ServerPlayerEntity player = ctx.get().getSender();
|
||||
|
||||
CarryOnKeybinds.setKeyPressed(player, pressed);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package tschipp.carryon.proxy;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
|
|
@ -24,7 +24,7 @@ public class ClientProxy implements IProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getPlayer()
|
||||
public PlayerEntity getPlayer()
|
||||
{
|
||||
return Minecraft.getInstance().player;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package tschipp.carryon.proxy;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ public interface IProxy
|
|||
|
||||
public void setup(final FMLCommonSetupEvent event);
|
||||
|
||||
public EntityPlayer getPlayer();
|
||||
public PlayerEntity getPlayer();
|
||||
|
||||
public World getWorld();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package tschipp.carryon.proxy;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ public class ServerProxy implements IProxy
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getPlayer()
|
||||
public PlayerEntity getPlayer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ logoFile="logo.png"
|
|||
[[dependencies.carryon]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.13.2,1.14)"
|
||||
versionRange="[1.14.4,1.15)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
Loading…
Reference in New Issue
Block a user