Compare commits

...
Author SHA1 Message Date
Martin Robertz 7ab50f50e5 update 2025-03-09 22:16:30 +01:00
StaffiX 23bdc0859d Merge branch 'master' into reactor 2025-03-09 15:56:27 +01:00
StaffiX f8b1b957a5 spotless 2025-03-09 15:25:15 +01:00
StaffiX 7268db7037 harsher fuel use scaling for exponential fuel usage 2025-03-09 15:23:45 +01:00
StaffiX 3ef58ef010 make fuel conversion faster than 1 per tick 2025-03-09 15:23:44 +01:00
StaffiX 5320e50578 fix chaos shard dupe again 2025-03-09 15:23:43 +01:00
Maya 18cda6a4ee update 2025-03-08 14:28:23 -06:00
Maya 0b1efcbb35 Merge branch 'master' into reactor 2025-03-08 14:28:17 -06:00
YamiKami_Sama 565fc72d24 Fix OpenComputers component not properly loaded for Particle Generator (and probably other components) (#63) 2025-03-08 14:28:07 -06:00
StaffiX e755619edb spotless 2025-03-08 18:48:15 +01:00
Martin Robertz 38865f074d Merge branch 'master' into reactor 2025-03-07 17:33:32 +01:00
StaffiX 03d8451e7a edit config descriptions 2025-03-07 01:08:09 +01:00
StaffiX fb893cfbda Add config to use exponential fuel usage 2025-03-07 01:05:17 +01:00
StaffiX 3fbf782754 spotless 2025-03-06 23:19:08 +01:00
StaffiX d3036b8080 Remove chaos shard storage config 2025-03-06 23:08:13 +01:00
StaffiX 5acca560f6 Change reactor IO to make it work without inventory 2025-03-06 23:06:55 +01:00
StaffiX d3c5f46228 redirect decrStackSize to the core 2025-03-06 15:33:00 +01:00
StaffiX 62cd116c18 fully redirect setInventorySlotContents to the core 2025-03-06 15:24:10 +01:00
StaffiX 51833c1606 change default of chaos shard storage 2025-03-05 23:49:06 +01:00
StaffiX 082a1893a1 add another two config 2025-03-05 23:46:13 +01:00
StaffiX d27394af29 fix chaos shard dupes 2025-03-05 23:19:19 +01:00
StaffiX 6a9adc80d7 spotless and remove logger 2025-03-05 21:26:50 +01:00
StaffiX 2637e9d203 Add Reactor inventory and make stabilizers be able to do IO for the reactor 2025-03-05 21:22:07 +01:00
Maya e039519acf update 2025-01-22 18:58:37 -06:00
Shadow1590 bf5f0bcb5b Add Dislocator Inhibitor (#60) 2025-01-22 18:56:34 -06:00
Martin Robertz 7bca3009b6 update 2025-01-17 12:10:15 +01:00
Ruling-0 f7cac98ad5 Fix Magnet pulling fake item entities (#59) 2025-01-17 00:08:37 -06:00
Dream Master 07ed88515e update 2025-01-15 12:29:22 +01:00
Kogepan229andMartin Robertz 46e5d8a785 More configurable Magnet (#57)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2025-01-13 07:08:24 +00:00
Martin Robertz 2835b7a54e update 2024-12-31 14:46:23 +01:00
glowredman 2331e33ebb Add Localizations (#58) 2024-12-30 17:42:21 -06:00
Martin Robertz 1fa9420ec2 update 2024-12-27 10:07:48 +01:00
Wilhelm SchusterandMartin Robertz ee65279d0b Broaden support for mouse button keybinds (#56)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2024-12-26 21:35:47 -06:00
StaffiX c39fa5a19c spotless 2024-12-08 20:16:43 +01:00
StaffiX 062453df41 Make Draconic Reactor more configurable 2024-12-07 23:20:20 +01:00
Martin Robertz 8efee8630a update 2024-11-22 21:34:10 +01:00
25 changed files with 722 additions and 140 deletions

No files matched your search

+1
View File
@@ -29,3 +29,4 @@ src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
layout.json
+8 -24
View File
@@ -4,29 +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") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.10.26-GTNH:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.44-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.0:dev") {
transitive = false
}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev') {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.3:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.11.10-GTNH:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.7.29-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.6-GTNH:dev') {transitive = false}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {
transitive = false
}
compileOnly("curse.maven:computercraft-67504:2269339") {
transitive = false
}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false}
compileOnly("curse.maven:computercraft-67504:2269339") {transitive = false}
}
Binary file not shown.
+1 -1
View File
@@ -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.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -3
View File
@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -206,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.37'
}
@@ -20,6 +20,7 @@ import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
@@ -205,6 +206,10 @@ public class GUIReactor extends GUIBase {
100D) + "%");
}
text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel));
text.add(
"Full: " + (Utills.round(
(float) (core.convertedFuel + core.reactorFuel) / ConfigHandler.reactorFuelStorage * 100,
1000)) + "%");
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
}
@@ -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();
@@ -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");
}
}
@@ -1,15 +1,19 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
@@ -19,12 +23,12 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 16/6/2015.
*/
public class ReactorCore extends BlockDE implements ITileEntityProvider {
public class ReactorCore extends BlockCustomDrop implements ITileEntityProvider {
public ReactorCore() {
super(Material.iron);
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setBlockName("reactorCore");
this.setHardness(100F);
ModBlocks.register(this);
}
@@ -81,4 +85,19 @@ public class ReactorCore extends BlockDE implements ITileEntityProvider {
}
super.breakBlock(world, x, y, z, blockBroken, metadata);
}
@Override
protected boolean dropInventory() {
return true;
}
@Override
protected boolean hasCustomDropps() {
return false;
}
@Override
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
}
}
@@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.inventory.GenericInventory;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
@@ -20,10 +21,15 @@ import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
*/
public class ContainerReactor extends ContainerDataSync {
private static final int maximumFuelStorage = 10368;
private static final int nuggetFuelAmount = 16;
private static final int ingotFuelAmount = nuggetFuelAmount * 9;
private static final int blockFuelAmount = ingotFuelAmount * 9;
public static final int maximumFuelStorage = ConfigHandler.reactorFuelStorage;
public static final int nuggetFuelAmount = ConfigHandler.reactorFuelValue;
public static final int ingotFuelAmount = nuggetFuelAmount * 9;
public static final int blockFuelAmount = ingotFuelAmount * 9;
public static final int tinyChaosAmount = ConfigHandler.reactorChaosValue;
public static final int smallChaosAmount = tinyChaosAmount * 9;
public static final int largeChaosAmount = smallChaosAmount * 9;
public static final int fullChaosAmount = largeChaosAmount * 9;
private final TileReactorCore core;
private final EntityPlayer player;
private final GenericInventory ioSlots = new GenericInventory() {
@@ -194,20 +200,20 @@ public class ContainerReactor extends ContainerDataSync {
int stackSize = core.reactorFuel / nuggetFuelAmount;
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.nugget, stackSize, 1));
core.reactorFuel -= stackSize * nuggetFuelAmount;
} else if (core.convertedFuel / ingotFuelAmount >= 64) {
int stackSize = core.convertedFuel / blockFuelAmount;
} else if (core.convertedFuel / smallChaosAmount >= 64) {
int stackSize = core.convertedFuel / largeChaosAmount;
stackSize = Math.min(64, stackSize);
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 2));
core.convertedFuel -= stackSize * blockFuelAmount;
} else if (core.convertedFuel >= ingotFuelAmount) {
int stackSize = core.convertedFuel / ingotFuelAmount;
core.convertedFuel -= stackSize * largeChaosAmount;
} else if (core.convertedFuel >= smallChaosAmount) {
int stackSize = core.convertedFuel / smallChaosAmount;
stackSize = Math.min(64, stackSize);
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 1));
core.convertedFuel -= stackSize * ingotFuelAmount;
} else if (core.convertedFuel >= nuggetFuelAmount) {
int stackSize = core.convertedFuel / nuggetFuelAmount;
core.convertedFuel -= stackSize * smallChaosAmount;
} else if (core.convertedFuel >= tinyChaosAmount) {
int stackSize = core.convertedFuel / tinyChaosAmount;
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 0));
core.convertedFuel -= stackSize * nuggetFuelAmount;
core.convertedFuel -= stackSize * tinyChaosAmount;
}
}
return super.slotClick(slot, button, mode, player);
@@ -73,6 +73,11 @@ public class ConfigHandler {
public static boolean enableReactorBigBoom;
public static double reactorOutputMultiplier;
public static double reactorFuelUsageMultiplier;
public static boolean linearReactorFuelUsage;
public static int reactorFuelStorage;
public static int reactorFuelValue;
public static int reactorChaosValue;
public static boolean enableAutomation;
private static String[] defaultSpawnerList = new String[] { "ExampleMob1", "ExampleMob2",
"ExampleMob3 (these examples can be deleted)" };
@@ -319,13 +324,6 @@ public class ConfigHandler {
true,
"Setting this to false will reduce the reactor explosion to little more then a tnt blast")
.getBoolean(true);
reactorFuelUsageMultiplier = config.get(
"Draconic Reactor",
"FuelUsageMultiplier",
1,
"Use this to adjust how quickly the reactor uses fuel",
0,
1000000).getDouble(1);
reactorOutputMultiplier = config.get(
"Draconic Reactor",
"EnergyOutputMultiplier",
@@ -333,7 +331,45 @@ public class ConfigHandler {
"Use this to adjust the output of the reactor",
0,
1000000).getDouble(1);
reactorFuelUsageMultiplier = config.get(
"Draconic Reactor",
"FuelUsageMultiplier",
1,
"Use this to adjust how quickly the reactor uses fuel",
0,
1000000).getDouble(1);
linearReactorFuelUsage = config.get(
"Draconic Reactor",
"linearReactorFuelUsage",
linearReactorFuelUsage,
"Sets whether the reactor should use linear (true) fuel usage formula or exponential (false)")
.getBoolean(true);
reactorFuelStorage = config.get(
"Draconic Reactor",
"maxFuelStorage",
10368,
"Use this to adjust the maximum fuel storage of the reactor",
0,
10000000).getInt(10368);
reactorFuelValue = config.get(
"Draconic Reactor",
"awakenedDraconiumFuelValue",
16,
"Use this to adjust the fuel value of awakened draconium nugget",
0,
1000000).getInt(16);
reactorChaosValue = config.get(
"Draconic Reactor",
"chaosShardOutputValue",
16,
"Use this to adjust how much tiny chaos shards you get per fuel value",
0,
1000000).getInt(16);
enableAutomation = config.get(
"Draconic Reactor",
"enableAutomation",
false,
"Sets whether the reactor is automatable or not").getBoolean(false);
disabledNamesList.clear();
for (String s : disabledBlocksItems) {
disabledNamesList.add(s);
@@ -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";
}
@@ -0,0 +1,112 @@
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.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) {
return x >= this.xCoord - range && x <= this.xCoord + range + 1
&& y >= this.yCoord - range
&& y <= this.yCoord + range + 1
&& z >= this.zCoord - range
&& z <= this.zCoord + range + 1;
}
@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,12 +1,23 @@
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.blockFuelAmount;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.fullChaosAmount;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.ingotFuelAmount;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.maximumFuelStorage;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.nuggetFuelAmount;
import static com.brandon3055.draconicevolution.common.handler.ConfigHandler.linearReactorFuelUsage;
import static com.brandon3055.draconicevolution.common.handler.ConfigHandler.reactorOutputMultiplier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
@@ -24,12 +35,14 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.ReactorSound;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart.ComparatorMode;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
@@ -39,7 +52,7 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 16/6/2015.
*/
public class TileReactorCore extends TileObjectSync {
public class TileReactorCore extends TileObjectSync implements IInventory {
public static final int MAXIMUM_PART_DISTANCE = 10;
@@ -86,6 +99,12 @@ public class TileReactorCore extends TileObjectSync {
public int energySaturation = 0;
public int maxEnergySaturation = 0;
public float fuelStorageRatio = (float) ConfigHandler.reactorFuelStorage / 10368; // To keep the temperature
// increase unchanged from the
// default config if it's changed
int excessFuel = 0;
@SideOnly(Side.CLIENT)
private ReactorSound reactorSound;
@@ -110,6 +129,11 @@ public class TileReactorCore extends TileObjectSync {
case ONLINE, STOPPING -> runTick();
}
if (excessFuel > 0 || (reactorFuel + convertedFuel) < maximumFuelStorage) {
int useExcessFuel = Math.min(maximumFuelStorage - (reactorFuel + convertedFuel), excessFuel);
reactorFuel += useExcessFuel;
excessFuel -= useExcessFuel;
}
detectAndSendChanges();
}
@@ -145,8 +169,8 @@ public class TileReactorCore extends TileObjectSync {
private void startingTick() {
if (!startupInitialized) {
int totalFuel = reactorFuel + convertedFuel;
maxFieldCharge = totalFuel * 96.45061728395062 * 100;
maxEnergySaturation = (int) (totalFuel * 96.45061728395062 * 1000);
maxFieldCharge = (totalFuel / fuelStorageRatio) * 96.45061728395062 * 100;
maxEnergySaturation = (int) ((totalFuel / fuelStorageRatio) * 96.45061728395062 * 1000);
energySaturation = Math.min(energySaturation, maxEnergySaturation);
fieldCharge = Math.min(fieldCharge, maxFieldCharge);
startupInitialized = true;
@@ -196,7 +220,7 @@ public class TileReactorCore extends TileObjectSync {
}
// Energy Calculation
int baseMaxRFt = (int) ((maxEnergySaturation / 1000D) * ConfigHandler.reactorOutputMultiplier * 1.5D);
int baseMaxRFt = (int) ((maxEnergySaturation / 1000D) * reactorOutputMultiplier * 1.5D);
int maxRFt = (int) (baseMaxRFt * (1D + conversion * 2));
generationRate = (1D - saturation) * maxRFt;
energySaturation += generationRate;
@@ -215,12 +239,17 @@ public class TileReactorCore extends TileObjectSync {
fieldCharge -= fieldDrain;
// Calculate Fuel Usage
fuelUseRate = tempDrainFactor * (1D - saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier);
if (linearReactorFuelUsage) {
fuelUseRate = tempDrainFactor * (1D - saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier);
} else {
fuelUseRate = tempDrainFactor * (1D - Math.pow(Math.max(saturation - 0.1, 0.1), 0.3))
* (0.001 * ConfigHandler.reactorFuelUsageMultiplier);
}
conversionUnit += fuelUseRate;
if (conversionUnit >= 1 && reactorFuel > 0) {
conversionUnit--;
reactorFuel--;
convertedFuel++;
reactorFuel -= (int) conversionUnit;
convertedFuel += (int) conversionUnit;
conversionUnit -= (int) conversionUnit;
}
if (fieldCharge <= 0 && !hasExploded) {
@@ -361,7 +390,7 @@ public class TileReactorCore extends TileObjectSync {
energySaturation += energyInjected;
} else if (reactionTemperature < 2000) {
energyInjected = energyToInject;
reactionTemperature += (double) energyInjected / (1000D + reactorFuel * 10);
reactionTemperature += (double) energyInjected / (1000D + (reactorFuel / fuelStorageRatio) * 10);
if (reactionTemperature > 2000) {
reactionTemperature = 2000;
}
@@ -401,7 +430,7 @@ public class TileReactorCore extends TileObjectSync {
}
public double getCoreRadius() {
double volume = (double) (reactorFuel + convertedFuel) / 1296D;
double volume = (double) (reactorFuel + convertedFuel) / (1296D * fuelStorageRatio);
volume *= 1 + (reactionTemperature / maxReactTemperature) * 10D;
return Math.cbrt(volume / (4D / 3D * Math.PI));
}
@@ -586,6 +615,7 @@ public class TileReactorCore extends TileObjectSync {
compound.setInteger("maxEnergySaturation", maxEnergySaturation);
compound.setInteger("reactorFuel", reactorFuel);
compound.setInteger("convertedFuel", convertedFuel);
compound.setInteger("excessFuel", excessFuel);
compound.setDouble("reactionTemperature", reactionTemperature);
compound.setDouble("maxReactTemperature", maxReactTemperature);
compound.setDouble("fieldCharge", fieldCharge);
@@ -613,6 +643,7 @@ public class TileReactorCore extends TileObjectSync {
maxEnergySaturation = compound.getInteger("maxEnergySaturation");
reactorFuel = compound.getInteger("reactorFuel");
convertedFuel = compound.getInteger("convertedFuel");
excessFuel = compound.getInteger("excessFuel");
reactionTemperature = compound.getDouble("reactionTemperature");
maxReactTemperature = compound.getDouble("maxReactTemperature");
fieldCharge = compound.getDouble("fieldCharge");
@@ -666,4 +697,106 @@ public class TileReactorCore extends TileObjectSync {
}
return new Object[] {};
}
@Override
public int getSizeInventory() {
return 1;
}
public ItemStack getStackInSlot(int i) {
if (convertedFuel > fullChaosAmount) {
return new ItemStack(ModItems.chaosShard, convertedFuel / fullChaosAmount);
}
return null;
}
@Override
public ItemStack decrStackSize(int i, int count) {
if (convertedFuel > fullChaosAmount) {
int chaosShardCount = Math.min((convertedFuel / fullChaosAmount), count);
convertedFuel -= chaosShardCount * fullChaosAmount;
return new ItemStack(ModItems.chaosShard, chaosShardCount);
}
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
return null;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
if (fuelValue(stack) > 0) {
int fuelValue = fuelValue(stack) * stack.stackSize;
if (fuelValue > maximumFuelStorage - (reactorFuel + convertedFuel)) {
fuelValue -= maximumFuelStorage - (reactorFuel + convertedFuel);
reactorFuel = maximumFuelStorage - convertedFuel;
excessFuel += fuelValue;
} else {
reactorFuel += fuelValue;
}
} else if (stack != null) {
convertedFuel = stack.stackSize * fullChaosAmount;
} else {
convertedFuel -= (convertedFuel / fullChaosAmount) * fullChaosAmount;
}
}
@Override
public String getInventoryName() {
return "";
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if (worldObj == null) {
return true;
}
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
}
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64;
}
@Override
public void openInventory() {
System.out.println("open");
}
@Override
public void closeInventory() {
System.out.println("close");
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack item) {
return false;
}
public int fuelValue(ItemStack item) {
Set<String> oreNames = OreDictionaryHelper.getOreNames(item);
if (oreNames.contains("blockDraconiumAwakened")) {
return blockFuelAmount;
}
if (oreNames.contains("ingotDraconiumAwakened")) {
return ingotFuelAmount;
}
if (oreNames.contains("nuggetDraconiumAwakened")) {
return nuggetFuelAmount;
}
return 0;
}
}
@@ -1,5 +1,13 @@
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.fullChaosAmount;
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.maximumFuelStorage;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
@@ -11,7 +19,9 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
import cofh.api.energy.IEnergyProvider;
@@ -22,7 +32,8 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by brandon3055 on 5/7/2015.
*/
public class TileReactorStabilizer extends TileEntity implements IReactorPart, IEnergyProvider, IDEPeripheral {
public class TileReactorStabilizer extends TileEntity
implements IReactorPart, IEnergyProvider, IDEPeripheral, ISidedInventory {
public float coreRotation = 0F;
public float ringRotation = 0F;
@@ -229,4 +240,93 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I
TileReactorCore core = getMaster();
return core != null ? core.callMethod(methodName, args) : null;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
int[] i = new int[getSizeInventory()];
for (int i1 = 0; i1 < i.length; i1++) i[i1] = i1;
return i;
}
@Override
public boolean canInsertItem(int slot, ItemStack item, int side) {
TileReactorCore core = getMaster();
return (ConfigHandler.enableAutomation && (core.reactorFuel + core.convertedFuel) < maximumFuelStorage);
}
@Override
public boolean canExtractItem(int slot, ItemStack item, int side) {
TileReactorCore core = getMaster();
return (ConfigHandler.enableAutomation && core.convertedFuel > fullChaosAmount);
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public ItemStack getStackInSlot(int slotIn) {
TileReactorCore core = getMaster();
return core.getStackInSlot(slotIn);
}
@Override
public ItemStack decrStackSize(int i, int count) {
TileReactorCore core = getMaster();
return core.decrStackSize(i, count);
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
return null;
}
@Override
public void setInventorySlotContents(int i, ItemStack stack) {
TileReactorCore core = getMaster();
core.setInventorySlotContents(i, stack);
}
@Override
public String getInventoryName() {
return "";
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public int getInventoryStackLimit() {
TileReactorCore core = getMaster();
return core.getInventoryStackLimit();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return false;
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
return validInputItems(stack);
}
public boolean validInputItems(ItemStack item) {
Set<String> oreNames = OreDictionaryHelper.getOreNames(item);
return (oreNames.contains("nuggetDraconiumAwakened") || oreNames.contains("ingotDraconiumAwakened")
|| oreNames.contains("blockDraconiumAwakened"));
}
}
@@ -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);
}
}
@@ -2,10 +2,12 @@ package com.brandon3055.draconicevolution.integration.computers.oc;
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
import li.cil.oc.api.Network;
import li.cil.oc.api.driver.NamedBlock;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedPeripheral;
import li.cil.oc.api.network.Visibility;
import li.cil.oc.api.prefab.ManagedEnvironment;
/**
@@ -17,6 +19,7 @@ public class DEManagedPeripheral extends ManagedEnvironment implements ManagedPe
public DEManagedPeripheral(IDEPeripheral peripheral) {
this.peripheral = peripheral;
super.setNode(Network.newNode(this, Visibility.Network).withComponent(peripheral.getName()).create());
}
@Override
@@ -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