mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 14:24:14 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10e6ebbe51 | ||
|
|
854e4cb3ce | ||
|
|
7bca3009b6 | ||
|
|
f7cac98ad5 | ||
|
|
07ed88515e | ||
|
|
46e5d8a785 | ||
|
|
2835b7a54e | ||
|
|
2331e33ebb | ||
|
|
1fa9420ec2 | ||
|
|
ee65279d0b | ||
|
|
8efee8630a |
No files matched your search
+3
-3
@@ -4,13 +4,13 @@ dependencies {
|
||||
api("com.github.GTNewHorizons:BrandonsCore:1.2.0-GTNH:dev")
|
||||
api("curse.maven:cofh-lib-220333:2388748")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.9.16:api") {
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.1:api") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:OpenComputers:1.10.26-GTNH:api") {
|
||||
compileOnly("com.github.GTNewHorizons:OpenComputers:1.11.4-GTNH:api") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.44-GTNH:dev") {
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.7.22-GTNH:dev") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev") {
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31'
|
||||
}
|
||||
|
||||
|
||||
+81
-67
@@ -1,11 +1,13 @@
|
||||
package com.brandon3055.draconicevolution.client.keybinding;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
@@ -36,45 +38,56 @@ public class KeyInputHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event) {
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (KeyBindings.placeItem.isPressed()) {
|
||||
handlePlaceItemKey();
|
||||
} else if (KeyBindings.toolConfig.isPressed()) {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
|
||||
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null
|
||||
&& Minecraft.getMinecraft().thePlayer.getItemInUse() == null) {
|
||||
DraconicEvolution.network
|
||||
.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
|
||||
handleToolConfigKey();
|
||||
} else if (KeyBindings.toolProfileChange.isPressed() && player != null && player.getItemInUse() == null) {
|
||||
handleToolProfileChangeKey(player);
|
||||
} else if (KeyBindings.toggleFlight.isPressed() && player != null) {
|
||||
handleToggleFlightKey(player);
|
||||
} else if (KeyBindings.toggleMagnet.isPressed()) {
|
||||
handleToggleMagnetKey(player);
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem
|
||||
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
if (++preset >= 5) preset = 0;
|
||||
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
|
||||
}
|
||||
} else
|
||||
if (KeyBindings.toggleFlight.isPressed()) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player.capabilities.allowFlying) {
|
||||
if (player.capabilities.isFlying) {
|
||||
player.capabilities.isFlying = false;
|
||||
} else {
|
||||
player.capabilities.isFlying = true;
|
||||
if (player.onGround) {
|
||||
player.setPosition(player.posX, player.posY + 0.05D, player.posZ);
|
||||
player.motionY = 0;
|
||||
}
|
||||
}
|
||||
player.sendPlayerAbilities();
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onMouseInput(InputEvent.MouseInputEvent event) {
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (KeyBindings.placeItem.isPressed()) {
|
||||
handlePlaceItemKey();
|
||||
} else if (KeyBindings.toolConfig.isPressed()) {
|
||||
handleToolConfigKey();
|
||||
} else if (KeyBindings.toolProfileChange.isPressed() && player != null) {
|
||||
handleToolProfileChangeKey(player);
|
||||
} else if (KeyBindings.toggleFlight.isPressed() && player != null) {
|
||||
handleToggleFlightKey(player);
|
||||
} else if (KeyBindings.toggleMagnet.isPressed()) {
|
||||
handleToggleMagnetKey(player);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
int change = Mouse.getEventDWheel();
|
||||
if (change == 0 || !player.isSneaking()) return;
|
||||
|
||||
if (change > 0) {
|
||||
ItemStack item = player.inventory.getStackInSlot(previousSlot(1, player.inventory.currentItem));
|
||||
if (item != null && Objects.equals(item.getItem(), ModItems.teleporterMKII)) {
|
||||
player.inventory.currentItem = previousSlot(1, player.inventory.currentItem);
|
||||
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, -1, false));
|
||||
}
|
||||
} else if (KeyBindings.toggleMagnet.isPressed()) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
Optional<ItemStack> magnetOptional = InventoryUtils.getItemInAnyPlayerInventory(player, Magnet.class);
|
||||
|
||||
if (magnetOptional.isPresent()) {
|
||||
DraconicEvolution.network.sendToServer(new MagnetTogglePacket());
|
||||
} else {
|
||||
ItemStack item = player.inventory.getStackInSlot(previousSlot(-1, player.inventory.currentItem));
|
||||
if (item != null && Objects.equals(item.getItem(), ModItems.teleporterMKII)) {
|
||||
player.inventory.currentItem = previousSlot(-1, player.inventory.currentItem);
|
||||
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, 1, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePlaceItemKey() {
|
||||
@@ -87,45 +100,46 @@ public class KeyInputHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onMouseInput(InputEvent.MouseInputEvent event) {
|
||||
if (KeyBindings.placeItem.isPressed()) {
|
||||
handlePlaceItemKey();
|
||||
} else if (KeyBindings.toolConfig.isPressed()) {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
|
||||
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null) {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
|
||||
private void handleToolConfigKey() {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
|
||||
}
|
||||
|
||||
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem
|
||||
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
if (++preset >= 5) preset = 0;
|
||||
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
|
||||
}
|
||||
}
|
||||
private void handleToolProfileChangeKey(@Nonnull EntityClientPlayerMP player) {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
int change = Mouse.getEventDWheel();
|
||||
if (change == 0 || !player.isSneaking()) return;
|
||||
|
||||
if (change > 0) {
|
||||
ItemStack item = player.inventory.getStackInSlot(previouseSlot(1, player.inventory.currentItem));
|
||||
if (item != null && item.getItem().equals(ModItems.teleporterMKII)) {
|
||||
player.inventory.currentItem = previouseSlot(1, player.inventory.currentItem);
|
||||
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, -1, false));
|
||||
}
|
||||
} else {
|
||||
ItemStack item = player.inventory.getStackInSlot(previouseSlot(-1, player.inventory.currentItem));
|
||||
if (item != null && item.getItem().equals(ModItems.teleporterMKII)) {
|
||||
player.inventory.currentItem = previouseSlot(-1, player.inventory.currentItem);
|
||||
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, 1, false));
|
||||
}
|
||||
ItemStack stack = player.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem
|
||||
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
if (++preset >= 5) preset = 0;
|
||||
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
|
||||
}
|
||||
}
|
||||
|
||||
private int previouseSlot(int i, int c) {
|
||||
private void handleToggleFlightKey(@Nonnull EntityClientPlayerMP player) {
|
||||
if (player.capabilities.allowFlying) {
|
||||
if (player.capabilities.isFlying) {
|
||||
player.capabilities.isFlying = false;
|
||||
} else {
|
||||
player.capabilities.isFlying = true;
|
||||
if (player.onGround) {
|
||||
player.setPosition(player.posX, player.posY + 0.05D, player.posZ);
|
||||
player.motionY = 0;
|
||||
}
|
||||
}
|
||||
player.sendPlayerAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleToggleMagnetKey(EntityClientPlayerMP player) {
|
||||
Optional<ItemStack> magnetOptional = InventoryUtils.getItemInAnyPlayerInventory(player, Magnet.class);
|
||||
|
||||
if (magnetOptional.isPresent()) {
|
||||
DraconicEvolution.network.sendToServer(new MagnetTogglePacket());
|
||||
}
|
||||
}
|
||||
|
||||
private int previousSlot(int i, int c) {
|
||||
if (c > 0 && c < 8) return c + i;
|
||||
if (c == 0 && i < 0) return 8;
|
||||
if (c == 8 && i > 0) return 0;
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
@@ -262,6 +263,9 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard");
|
||||
GameRegistry
|
||||
.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier");
|
||||
GameRegistry.registerTileEntity(
|
||||
TileDislocatorInhibitor.class,
|
||||
References.RESOURCESPREFIX + "TileDislocatorInhibitor");
|
||||
if (DraconicEvolution.debug) {
|
||||
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
|
||||
GameRegistry.registerTileEntity(
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.brandon3055.draconicevolution.common.blocks.SafetyFlame;
|
||||
import com.brandon3055.draconicevolution.common.blocks.TeleporterStand;
|
||||
import com.brandon3055.draconicevolution.common.blocks.TestBlock;
|
||||
import com.brandon3055.draconicevolution.common.blocks.XRayBlock;
|
||||
import com.brandon3055.draconicevolution.common.blocks.machine.DislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.blocks.machine.DissEnchanter;
|
||||
import com.brandon3055.draconicevolution.common.blocks.machine.EnergyCrystal;
|
||||
import com.brandon3055.draconicevolution.common.blocks.machine.EnergyInfuser;
|
||||
@@ -90,6 +91,7 @@ public class ModBlocks {
|
||||
public static BlockDE reactorEnergyInjector;
|
||||
public static BlockDE chaosCrystal;
|
||||
public static BlockDE upgradeModifier;
|
||||
public static BlockDE dislocatorInhibitor;
|
||||
public static Block safetyFlame;
|
||||
public static Block chaosShardAtmos = new ChaosShardAtmos()
|
||||
.setBlockName(References.RESOURCESPREFIX + "chaosShardAtmos")
|
||||
@@ -133,6 +135,7 @@ public class ModBlocks {
|
||||
reactorEnergyInjector = new ReactorEnergyInjector();
|
||||
chaosCrystal = new ChaosCrystal();
|
||||
upgradeModifier = new UpgradeModifier();
|
||||
dislocatorInhibitor = new DislocatorInhibitor();
|
||||
|
||||
longRangeDislocator = new LongRangeDislocator();
|
||||
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class DislocatorInhibitor extends BlockDE implements ITileEntityProvider {
|
||||
|
||||
public DislocatorInhibitor() {
|
||||
this.setBlockName(Strings.dislocatorInhibitor);
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileDislocatorInhibitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx,
|
||||
float pry, float prz) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
if (tile instanceof TileDislocatorInhibitor te) {
|
||||
if (!player.isSneaking()) te.increaseRange();
|
||||
else te.decreaseRange();
|
||||
|
||||
if (world.isRemote) player.addChatMessage(new ChatComponentText("Range: " + te.getRange()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, int x, int y, int z, Block blockBroken, int meta) {
|
||||
TileEntity tile = worldIn.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
if (tile instanceof TileDislocatorInhibitor) {
|
||||
((TileDislocatorInhibitor) tile).unregister();
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(worldIn, x, y, z, blockBroken, meta);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "inhibitor_block");
|
||||
}
|
||||
}
|
||||
@@ -609,6 +609,17 @@ public class CraftingHandler {
|
||||
"ingotDraconium",
|
||||
'C',
|
||||
ModItems.draconicCore);
|
||||
addOre(
|
||||
ModBlocks.dislocatorInhibitor,
|
||||
"IBI",
|
||||
"BDB",
|
||||
"IBI",
|
||||
'I',
|
||||
"ingotIron",
|
||||
'B',
|
||||
Blocks.iron_bars,
|
||||
'D',
|
||||
new ItemStack(ModItems.magnet, 1, 0));
|
||||
|
||||
// machines adv
|
||||
ItemStack mobSoul = new ItemStack(ModItems.mobSoul);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -11,6 +12,7 @@ import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -25,6 +27,10 @@ import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.integration.ModHelper;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
@@ -37,7 +43,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
|
||||
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles")
|
||||
public class Magnet extends ItemDE implements IBauble {
|
||||
public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
|
||||
private IIcon draconium;
|
||||
private IIcon awakened;
|
||||
@@ -85,9 +91,14 @@ public class Magnet extends ItemDE implements IBauble {
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean hotbar) {
|
||||
if (!entity.isSneaking() && entity.ticksExisted % 5 == 0
|
||||
&& isEnabled(stack)
|
||||
&& entity instanceof EntityPlayer) {
|
||||
if (entity.ticksExisted % 5 != 0 || !isEnabled(stack)) {
|
||||
return;
|
||||
}
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.MAGNET_SNEAK, true) && entity.isSneaking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer player) {
|
||||
int range = stack.getItemDamage() == 0 ? 8 : 32;
|
||||
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(
|
||||
@@ -103,7 +114,8 @@ public class Magnet extends ItemDE implements IBauble {
|
||||
boolean playSound = false;
|
||||
|
||||
for (EntityItem item : items) {
|
||||
if (item.getEntityItem() == null) {
|
||||
if (item.getEntityItem() == null || ModHelper.isAE2EntityFloatingItem(item)
|
||||
|| TileDislocatorInhibitor.isInInhibitorRange(world, item.posX, item.posY, item.posZ)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -145,7 +157,6 @@ public class Magnet extends ItemDE implements IBauble {
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ).expand(4, 4, 4));
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
for (EntityXPOrb orb : xp) {
|
||||
if (orb.field_70532_c == 0 && orb.isEntityAlive()) {
|
||||
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, orb))) continue;
|
||||
@@ -164,15 +175,24 @@ public class Magnet extends ItemDE implements IBauble {
|
||||
}
|
||||
|
||||
public static boolean isEnabled(ItemStack itemStack) {
|
||||
return ItemNBTHelper.getBoolean(itemStack, "MagnetEnabled", false);
|
||||
// For backward compatibility
|
||||
if (ItemNBTHelper.verifyExistance(itemStack, "MagnetEnabled")) {
|
||||
final NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
final boolean enabled = nbt.getBoolean("MagnetEnabled");
|
||||
IConfigurableItem.ProfileHelper.setBoolean(itemStack, References.ENABLED, enabled);
|
||||
nbt.removeTag("MagnetEnabled");
|
||||
return enabled;
|
||||
}
|
||||
return IConfigurableItem.ProfileHelper.getBoolean(itemStack, References.ENABLED, false);
|
||||
}
|
||||
|
||||
public static void toggle(ItemStack itemStack) {
|
||||
ItemNBTHelper.setBoolean(itemStack, "MagnetEnabled", !isEnabled(itemStack));
|
||||
final boolean enabled = IConfigurableItem.ProfileHelper.getBoolean(itemStack, References.ENABLED, false);
|
||||
IConfigurableItem.ProfileHelper.setBoolean(itemStack, References.ENABLED, !enabled);
|
||||
}
|
||||
|
||||
public static void setStatus(ItemStack itemStack, boolean status) {
|
||||
ItemNBTHelper.setBoolean(itemStack, "MagnetEnabled", status);
|
||||
IConfigurableItem.ProfileHelper.setBoolean(itemStack, References.ENABLED, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -230,4 +250,17 @@ public class Magnet extends ItemDE implements IBauble {
|
||||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
fields.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.ENABLED).readFromItem(stack, false));
|
||||
fields.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.MAGNET_SNEAK).readFromItem(stack, true));
|
||||
return fields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,6 @@ public final class References {
|
||||
public static final String OBLITERATE = "ToolVoidJunk";
|
||||
public static final String TREE_MODE = "AxeTreeMode";
|
||||
public static final String BASE_SAFE_AOE = "BaseSafeAOE";
|
||||
public static final String ENABLED = "Enabled";
|
||||
public static final String MAGNET_SNEAK = "MagnetSneak";
|
||||
}
|
||||
@@ -72,4 +72,5 @@ public class Strings { // public static Block name
|
||||
public static final String draconiumFluxCapacitorName = "draconiumFluxCapacitor";
|
||||
public static final String energyCrystalName = "energyCrystal";
|
||||
public static final String wrenchName = "wrench";
|
||||
public static final String dislocatorInhibitor = "dislocatorInhibitor";
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileDislocatorInhibitor extends TileEntity {
|
||||
|
||||
public static final int MAXIMUM_RANGE = 16;
|
||||
public static final int MINIMUM_RANGE = 1;
|
||||
public static final HashMap<World, HashSet<TileDislocatorInhibitor>> inhibitors = new HashMap<>();
|
||||
|
||||
private boolean registered = false;
|
||||
private int range = 5;
|
||||
|
||||
public static boolean isInInhibitorRange(World world, double x, double y, double z) {
|
||||
HashSet<TileDislocatorInhibitor> list = inhibitors.get(world);
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
for (TileDislocatorInhibitor inhibitor : list) {
|
||||
if (inhibitor.isInRange(x, y, z)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!registered) {
|
||||
HashSet<TileDislocatorInhibitor> map = inhibitors.computeIfAbsent(this.worldObj, k -> new HashSet<>());
|
||||
map.add(this);
|
||||
registered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
if (inhibitors.containsKey(this.worldObj)) {
|
||||
HashSet<TileDislocatorInhibitor> list = inhibitors.get(this.worldObj);
|
||||
list.remove(this);
|
||||
if (list.isEmpty()) {
|
||||
inhibitors.remove(this.worldObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
public void setRange(int value) {
|
||||
if (value > MAXIMUM_RANGE) {
|
||||
value = MINIMUM_RANGE;
|
||||
}
|
||||
if (value < MINIMUM_RANGE) {
|
||||
value = MAXIMUM_RANGE;
|
||||
}
|
||||
this.range = value;
|
||||
}
|
||||
|
||||
public void increaseRange() {
|
||||
if (range < MAXIMUM_RANGE) {
|
||||
range++;
|
||||
}
|
||||
}
|
||||
|
||||
public void decreaseRange() {
|
||||
if (range > MINIMUM_RANGE) {
|
||||
range--;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInRange(double x, double y, double z) {
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(
|
||||
this.xCoord + 0.5,
|
||||
this.yCoord + 0.5,
|
||||
this.zCoord + 0.5,
|
||||
this.xCoord + 0.5,
|
||||
this.yCoord + 0.5,
|
||||
this.zCoord + 0.5).expand(range + 0.5, range + 0.5, range + 0.5);
|
||||
return x >= aabb.minX && x <= aabb.maxX && y >= aabb.minY && y <= aabb.maxY && z >= aabb.minZ && z <= aabb.maxZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
this.writeToNBT(tagCompound);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("Range", range);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
range = compound.getInteger("Range");
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.integration;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -21,6 +22,7 @@ public class ModHelper {
|
||||
// private static boolean isRotaryCraftInstalled;
|
||||
private static final boolean isGregTechInstalled;
|
||||
private static final boolean isBartworkdsInstalled;
|
||||
private static final boolean isAE2Installed;
|
||||
|
||||
private static Item cleaver;
|
||||
private static Item avaritiaSword;
|
||||
@@ -28,6 +30,7 @@ public class ModHelper {
|
||||
|
||||
private static Class<?> bwores;
|
||||
private static Class<?> GTores;
|
||||
private static Class<?> AE2FItem;
|
||||
|
||||
static {
|
||||
isTConInstalled = Loader.isModLoaded("TConstruct");
|
||||
@@ -35,8 +38,10 @@ public class ModHelper {
|
||||
// isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft");
|
||||
isGregTechInstalled = Loader.isModLoaded("gregtech");
|
||||
isBartworkdsInstalled = Loader.isModLoaded("bartworks");
|
||||
isAE2Installed = Loader.isModLoaded("appliedenergistics2");
|
||||
final String GT_ORE_CLASS = "gregtech.common.blocks.TileEntityOres";
|
||||
final String BW_ORE_CLASS = "bartworks.system.material.BWMetaGeneratedOres";
|
||||
final String AE2_FITEM_CLASS = "appeng.entity.EntityFloatingItem";
|
||||
if (isGregTechInstalled) try {
|
||||
GTores = Class.forName(GT_ORE_CLASS);
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -47,6 +52,11 @@ public class ModHelper {
|
||||
} catch (ClassNotFoundException e) {
|
||||
LogHelper.error("Couldn't reflect class " + BW_ORE_CLASS);
|
||||
}
|
||||
if (isAE2Installed) try {
|
||||
AE2FItem = Class.forName(AE2_FITEM_CLASS);
|
||||
} catch (ClassNotFoundException e) {
|
||||
LogHelper.error("Couldn't reflect class " + AE2_FITEM_CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHoldingCleaver(EntityPlayer player) {
|
||||
@@ -112,4 +122,8 @@ public class ModHelper {
|
||||
public static boolean isGregTechTileEntityOre(TileEntity te) {
|
||||
return isGregTechInstalled && GTores.isInstance(te) || isBartworkdsInstalled && bwores.isInstance(te);
|
||||
}
|
||||
|
||||
public static boolean isAE2EntityFloatingItem(EntityItem item) {
|
||||
return isAE2Installed && AE2FItem.isInstance(item);
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,14 @@ tile.draconicevolution:playerDetectorAdvanced.name=Advanced Player Detector
|
||||
tile.draconicevolution:energyInfuser.name=Energy Infuser
|
||||
tile.draconicevolution:earth.name=Earth
|
||||
tile.draconicevolution:customSpawner.name=Stabilized Mob Spawner
|
||||
tile.draconicevolution:longRangeDislocator.name=Long Range Dislocator
|
||||
tile.draconicevolution:longRangeDislocator1.name=Admin Dislocator
|
||||
tile.draconicevolution:longRangeDislocator0.name=Long Range Dislocator
|
||||
tile.draconicevolution:generator.name=Generator
|
||||
tile.draconicevolution:energyStorageCore.name=Energy Core
|
||||
tile.draconicevolution:invisibleMultiblock.name=Energy Core
|
||||
tile.draconicevolution:energyPylon.name=Energy Pylon
|
||||
tile.draconicevolution:draconium.name=Draconium Block
|
||||
tile.draconicevolution:draconium0.name=Draconium Block
|
||||
tile.draconicevolution:draconium1.name=Resurrection Stone
|
||||
tile.draconicevolution:draconium2.name=Charged Draconium Block
|
||||
@@ -29,6 +31,7 @@ tile.draconicevolution:draconicBlock.name=Awakened Draconium Block
|
||||
tile.draconicevolution:infusedObsidian.name=Draconium Infused Obsidian
|
||||
tile.draconicevolution:dislocatorReceptacle.name=Dislocator Receptacle
|
||||
tile.draconicevolution:portal.name=Portal
|
||||
tile.draconicevolution:flowGate.name=Gate
|
||||
tile.draconicevolution:flowGateFlux.name=Flux Gate
|
||||
tile.draconicevolution:flowGateFluid.name=Fluid Gate
|
||||
tile.draconicevolution:reactorCore.name=Draconic Reactor Core
|
||||
@@ -36,13 +39,18 @@ tile.draconicevolution:reactorStabilizer.name=Reactor Stabilizer
|
||||
tile.draconicevolution:reactorEnergyInjector.name=Reactor Energy Injector
|
||||
tile.draconicevolution:chaosCrystal.name=Chaos Crystal
|
||||
tile.draconicevolution:upgradeModifier.name=Upgrade Modifier
|
||||
tile.draconicevolution:chaosShardAtmos.name=Chaos Shard
|
||||
tile.draconicevolution:placedItem.name=Placed Item
|
||||
tile.draconicevolution:safetyFlame.name=Safety Flame
|
||||
|
||||
tile.draconicevolution:energyCrystal.name=Energy Relay/Transceiver
|
||||
tile.draconicevolution:energyCrystal0.name=Energy Relay
|
||||
tile.draconicevolution:energyCrystal1.name=Advanced Energy Relay
|
||||
tile.draconicevolution:energyCrystal2.name=Energy Transceiver
|
||||
tile.draconicevolution:energyCrystal3.name=Advanced Energy Transceiver
|
||||
tile.draconicevolution:energyCrystal4.name=Wireless Energy Transceiver
|
||||
tile.draconicevolution:energyCrystal5.name=Advanced Wireless Transceiver
|
||||
tile.draconicevolution:dislocatorInhibitor.name=Dislocator Inhibitor
|
||||
|
||||
|
||||
//Item Information ----------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -85,16 +93,20 @@ item.draconicevolution:enderArrow.name=Ender Arrow
|
||||
item.draconicevolution:safetyMatch.name=Safety Match
|
||||
item.draconicevolution:safetyMatchBox.name=Box of Safety Matches
|
||||
item.draconicevolution:key.name=Key
|
||||
item.draconicevolution:draconiumEnergyCore.name=Energy Core
|
||||
item.draconicevolution:draconiumEnergyCore0.name=Wyvern Energy Core
|
||||
item.draconicevolution:draconiumEnergyCore1.name=Draconic Energy Core
|
||||
item.draconicevolution:draconiumFluxCapacitor.name=Flux Capacitor
|
||||
item.draconicevolution:draconiumFluxCapacitor0.name=Wyvern Flux Capacitor
|
||||
item.draconicevolution:draconiumFluxCapacitor1.name=Draconic Flux Capacitor
|
||||
item.draconicevolution:draconicIngot.name=Awakened Draconium Ingot
|
||||
item.draconicevolution:creativeStructureSpawner.name=Structure Spawner
|
||||
item.draconicevolution:creativeStructureSpawnerComet.name=Spawn Comet
|
||||
item.draconicevolution:creativeStructureSpawnerEnderIsland.name=Spawn Ender Island
|
||||
item.draconicevolution:infoTablet.name=Draconic Evolution Information Tablet
|
||||
item.draconicevolution:wrench.name=Crystal Binder
|
||||
item.draconicevolution:dezilsMarshmallow.name=Dezil's Marshmallow
|
||||
item.draconicevolution:reactorCraftingPart.name=Reactor Stabilizer
|
||||
item.draconicevolution:reactorCraftingPart.frame.name=Reactor Stabilizer Frame
|
||||
item.draconicevolution:reactorCraftingPart.rotorInner.name=Reactor Stabilizer Inner Rotor
|
||||
item.draconicevolution:reactorCraftingPart.rotorOuter.name=Reactor Stabilizer Outer Rotor
|
||||
@@ -102,13 +114,17 @@ item.draconicevolution:reactorCraftingPart.rotorAssembly.name=Reactor Stabilizer
|
||||
item.draconicevolution:reactorCraftingPart.stabilizerRing.name=Reactor Stabilizer Focus Ring
|
||||
item.draconicevolution:chaoticCore.name=Chaotic Core
|
||||
item.draconicevolution:chaosShard.name=Chaos Shard
|
||||
item.draconicevolution:chaosFragment.name=Chaos Fragment
|
||||
item.draconicevolution:chaosFragment0.name=Tiny Chaos Fragment
|
||||
item.draconicevolution:chaosFragment1.name=Small Chaos Fragment
|
||||
item.draconicevolution:chaosFragment2.name=Large Chaos Fragment
|
||||
item.draconicevolution:nugget.name=Draconium Nugget
|
||||
item.draconicevolution:nugget.draconium.name=Draconium Nugget
|
||||
item.draconicevolution:nugget.awakened.name=Awakened Draconium Nugget
|
||||
item.draconicevolution:magnet.name=Item Dislocator
|
||||
item.draconicevolution:magnet.wyvern.name=Item Dislocator
|
||||
item.draconicevolution:magnet.draconic.name=Awakened Item Dislocator
|
||||
item.draconicevolution:adminSpawnEgg.name=Spawn Egg
|
||||
|
||||
//Item Groups ----------------------------------------------------------------------------------------------------------------------------------------
|
||||
itemGroup.toolsAndWeapons=Draconic Evolution Tools & Weapons
|
||||
@@ -493,6 +509,8 @@ button.de.BowExplosionPower.name=Explosive Power
|
||||
button.de.BowShockWavePower.name=Shock Wave Power
|
||||
button.de.BowEnergyBolt.name=Arrow of Draconic Fire
|
||||
button.de.BowZoomModifier.name=Magnification
|
||||
button.de.Enabled.name=Enabled
|
||||
button.de.MagnetSneak.name=Disabled while sneaking
|
||||
|
||||
button.de.reactorCharge.txt=Charge Reactor
|
||||
button.de.reactorStart.txt=Activate
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 877 B |
Reference in new issue
Block a user