Skip to content

Commit

Permalink
Void satchel! :D
Browse files Browse the repository at this point in the history
Address enchanting weirdness.
Morb tweaks.

Signed-off-by: King Lemming <[email protected]>
  • Loading branch information
KingLemming committed Jan 1, 2018
1 parent 7247ac2 commit fbc1b24
Show file tree
Hide file tree
Showing 23 changed files with 358 additions and 166 deletions.
6 changes: 3 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ forge_version=14.23.1.2555
mappings=snapshot_20171003

# Mod Version
mod_version=5.3.8
mod_version=5.3.9

# Dependencies
rf_mc_version=1.12
rf_version=2.0.1.+
cofh_core_version=4.3.8.+
tf_version=2.3.8.+
cofh_core_version=4.3.9.+
tf_version=2.3.9.+

ccl_mc_version=1.12
ccl_version=3.1.3.+
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/cofh/thermalexpansion/ThermalExpansion.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import cofh.thermalexpansion.item.ItemFlorb;
import cofh.thermalexpansion.item.ItemMorb;
import cofh.thermalexpansion.network.PacketTEBase;
import cofh.thermalexpansion.plugins.jei.JEIPluginTE;
import cofh.thermalexpansion.proxy.Proxy;
import cofh.thermalexpansion.util.IMCHandler;
import cofh.thermalexpansion.util.managers.device.*;
Expand All @@ -17,6 +18,7 @@
import cofh.thermalfoundation.ThermalFoundation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
Expand All @@ -35,7 +37,7 @@ public class ThermalExpansion {
public static final String MOD_ID = "thermalexpansion";
public static final String MOD_NAME = "Thermal Expansion";

public static final String VERSION = "5.3.8";
public static final String VERSION = "5.3.9";
public static final String VERSION_MAX = "5.4.0";
public static final String VERSION_GROUP = "required-after:" + MOD_ID + "@[" + VERSION + "," + VERSION_MAX + ");";
public static final String UPDATE_URL = "https://raw.github.com/cofh/version/master/" + MOD_ID + "_update.json";
Expand Down Expand Up @@ -195,6 +197,10 @@ private synchronized void managerRefresh() {
ReactantManager.refresh();
EnervationManager.refresh();
NumismaticManager.refresh();

if (Loader.isModLoaded("jei")) {
JEIPluginTE.refresh();
}
}

}
9 changes: 8 additions & 1 deletion src/main/java/cofh/thermalexpansion/block/BlockTEBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {

RayTraceResult traceResult = RayTracer.retrace(player);

if (traceResult == null) {
return false;
}
PlayerInteractEvent event = new PlayerInteractEvent.RightClickBlock(player, hand, pos, side, traceResult.hitVec);
if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Result.DENY) {
return false;
Expand Down Expand Up @@ -216,7 +220,11 @@ public ArrayList<ItemStack> dismantleDelegate(NBTTagCompound nbt, World world, B
TileEntity tile = world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
int meta = state.getBlock().getMetaFromState(state);
ArrayList<ItemStack> ret = new ArrayList<>();

if (state.getBlock() != this) {
return ret;
}
ItemStack dropBlock = new ItemStack(this, 1, meta);

if (nbt != null) {
Expand Down Expand Up @@ -246,7 +254,6 @@ public ArrayList<ItemStack> dismantleDelegate(NBTTagCompound nbt, World world, B
}
}
}
ArrayList<ItemStack> ret = new ArrayList<>();
ret.add(dropBlock);
return ret;
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/cofh/thermalexpansion/block/TileTEBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cofh.api.core.IPortableData;
import cofh.core.block.TileCore;
import cofh.core.fluid.FluidTankCore;
import cofh.core.network.ITileInfoPacketHandler;
import cofh.core.network.ITilePacketHandler;
import cofh.core.network.PacketBase;
import cofh.core.network.PacketHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected void updateValidity() {
}
}
if (leafCount >= NUM_LEAVES) {
Iterable<BlockPos.MutableBlockPos> trunk = BlockPos.getAllInBoxMutable(trunkPos, trunkPos.add(0, leafPos[0].getY(), 0));
Iterable<BlockPos.MutableBlockPos> trunk = BlockPos.getAllInBoxMutable(trunkPos, trunkPos.add(0, leafPos[0].getY() - trunkPos.getY(), 0));

for (BlockPos scan : trunk) {
IBlockState state = world.getBlockState(scan);
Expand Down Expand Up @@ -293,7 +293,7 @@ protected void updateValidity() {
}
}
if (leafCount >= NUM_LEAVES) {
Iterable<BlockPos.MutableBlockPos> trunk = BlockPos.getAllInBoxMutable(trunkPos, trunkPos.add(0, leafPos[0].getY(), 0));
Iterable<BlockPos.MutableBlockPos> trunk = BlockPos.getAllInBoxMutable(trunkPos, trunkPos.add(0, leafPos[0].getY() - trunkPos.getY(), 0));

for (BlockPos scan : trunk) {
IBlockState state = world.getBlockState(scan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ public void handleElementButtonClick(String buttonName, int mouseButton) {
pitch += 0.1F;
break;
case "Lock0":
myTile.locks[2] = !myTile.locks[2];
pitch = myTile.locks[2] ? 0.8F : 0.4F;
myTile.locks[0] = !myTile.locks[0];
pitch = myTile.locks[0] ? 0.8F : 0.4F;
break;
case "Lock1":
myTile.locks[2] = !myTile.locks[2];
pitch = myTile.locks[2] ? 0.8F : 0.4F;
myTile.locks[1] = !myTile.locks[1];
pitch = myTile.locks[1] ? 0.8F : 0.4F;
break;
case "Lock2":
myTile.locks[2] = !myTile.locks[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@

public class GuiSatchel extends GuiContainerCore {

int level;
boolean secure;
boolean isCreative;
boolean isVoid;

boolean secure;
UUID playerName;
int storageIndex;

public GuiSatchel(InventoryPlayer inventory, ContainerSatchel container) {

super(container);

level = ItemSatchel.getLevel(container.getContainerStack());
secure = SecurityHelper.isSecure(container.getContainerStack());
isCreative = ItemSatchel.isCreative(container.getContainerStack());
isVoid = ItemSatchel.isVoid(container.getContainerStack());

secure = SecurityHelper.isSecure(container.getContainerStack());
playerName = SecurityHelper.getID(inventory.player);
storageIndex = ItemSatchel.getStorageIndex(container.getContainerStack());
texture = CoreProps.TEXTURE_STORAGE[storageIndex];
Expand All @@ -39,8 +41,13 @@ public GuiSatchel(InventoryPlayer inventory, ContainerSatchel container) {
xSize = 14 + 18 * MathHelper.clamp(storageIndex, 9, 14);
ySize = 112 + 18 * MathHelper.clamp(storageIndex, 2, 9);

generateInfo("tab.thermalexpansion.storage.satchel");

if (isCreative) {
generateInfo("tab.thermalexpansion.storage.satchel_c");
} else if (isVoid) {
generateInfo("tab.thermalexpansion.storage.satchel_v");
} else {
generateInfo("tab.thermalexpansion.storage.satchel");
}
if (container.getContainerStack().isItemEnchantable() && !ItemSatchel.hasHoldingEnchant(container.getContainerStack())) {
myInfo += "\n\n" + StringHelper.localize("tab.thermalexpansion.storage.enchant");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ public class GuiSatchelFilter extends GuiContainerCore {

String texturePath;

int level;
boolean secure;

UUID playerName;
int filterIndex;

Expand All @@ -33,9 +31,7 @@ public GuiSatchelFilter(InventoryPlayer inventory, ContainerSatchelFilter contai

super(container);

level = ItemSatchel.getLevel(container.getFilterStack());
secure = SecurityHelper.isSecure(container.getFilterStack());

playerName = SecurityHelper.getID(inventory.player);
filterIndex = ItemSatchel.getLevel(container.getFilterStack());
texture = CoreProps.TEXTURE_FILTER[filterIndex];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ public class ContainerSatchel extends ContainerInventoryItem implements ISecurab

static final String NAME = "item.thermalexpansion.satchel.name";

boolean isCreative;
boolean isVoid;

int storageIndex;
int rowSize;

public ContainerSatchel(ItemStack stack, InventoryPlayer inventory) {

super(stack, inventory);

isCreative = ItemSatchel.isCreative(stack);
isVoid = ItemSatchel.isVoid(stack);

storageIndex = ItemSatchel.getStorageIndex(stack);
rowSize = MathHelper.clamp(storageIndex, 9, 14);

Expand All @@ -50,7 +56,12 @@ public ContainerSatchel(ItemStack stack, InventoryPlayer inventory) {

switch (storageIndex) {
case 0:
addSlotToContainer(new SlotSatchelCreative(this, containerWrapper, 0, 80, 26));
addSlotToContainer(isVoid ? new Slot(containerWrapper, 0, 80, 26) {
@Override
public void putStack(ItemStack stack) {

}
} : new SlotSatchelCreative(this, containerWrapper, 0, 80, 26));
rowSize = 1;
break;
case 1:
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cofh/thermalexpansion/item/ItemFlorb.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player
return new ActionResult<>(EnumActionResult.PASS, stack);
}
//if (!player.capabilities.isCreativeMode) {
stack.shrink(1);
stack.shrink(1);
//}
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/cofh/thermalexpansion/item/ItemMorb.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -189,7 +187,7 @@ public static void parseMorbs() {
if (clazz == null || !EntityLiving.class.isAssignableFrom(clazz)) {
continue;
}
if (list.contains(name.toString())) {
if (list.contains(name.toString()) || !EntityList.ENTITY_EGGS.containsKey(name)) {
continue;
}
addMorb(ItemHelper.cloneStack(morbStandard), name.toString());
Expand Down Expand Up @@ -258,6 +256,8 @@ public boolean register() {
ItemStack morbStack = ItemHelper.cloneStack(morbStandard, 8);

addShapelessRecipe(morbStack, "dustWood", "crystalSlag", "slimeball", "enderpearl");
addShapelessRecipe(morbReusable, morbStandard, "nuggetSignalum", "nuggetSignalum", "nuggetSignalum");
addShapelessRecipe(morbStasis, morbReusable, "nuggetEnderium", "nuggetEnderium", "nuggetEnderium");

return true;
}
Expand All @@ -271,7 +271,7 @@ private static void config() {
enable = CONFIG_MORBS.getConfiguration().getBoolean("EnableRecipe", category, enable, comment);

category = "Blacklist";
comment = "List of entities that are not allowed to be placed in Morbs.";
comment = "List of entities that are not allowed to be placed in Morbs. Mobs without spawn eggs are automatically disallowed.";
blacklist = CONFIG_MORBS.getConfiguration().getStringList("Blacklist", category, blacklist, comment);
}

Expand All @@ -280,7 +280,7 @@ private static void config() {
public static ArrayList<ItemStack> morbList = new ArrayList<>();
public static Set<String> validMobs = new THashSet<>();

public static String[] blacklist = new String[] { "minecraft:wither", "minecraft:ender_dragon" };
public static String[] blacklist = new String[] {};
public static boolean enable = true;

public static final String GENERIC = "Generic";
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/cofh/thermalexpansion/item/ItemReservoir.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import cofh.core.item.ItemMulti;
import cofh.core.key.KeyBindingItemMultiMode;
import cofh.core.util.CoreUtils;
import cofh.core.util.RayTracer;
import cofh.core.util.capabilities.FluidContainerItemWrapper;
import cofh.core.util.core.IInitializer;
import cofh.core.util.helpers.*;
Expand Down Expand Up @@ -219,16 +220,14 @@ ActionResult<ItemStack> doBucketFill(ItemStack stack, @Nonnull World world, @Non
if (getSpace(stack) < Fluid.BUCKET_VOLUME) {
return ActionResult.newResult(EnumActionResult.PASS, stack);
}
RayTraceResult traceResult = this.rayTrace(world, player, false);
RayTraceResult traceResult = RayTracer.retrace(player, true);
if (traceResult == null || traceResult.typeOfHit != RayTraceResult.Type.BLOCK) {
return ActionResult.newResult(EnumActionResult.PASS, stack);
}
BlockPos pos = traceResult.getBlockPos();
if (world.isBlockModifiable(player, pos)) {
BlockPos targetPos = pos.offset(traceResult.sideHit);

if (player.canPlayerEdit(targetPos, traceResult.sideHit, stack)) {
FluidActionResult result = FluidUtil.tryPickUpFluid(stack, player, world, targetPos, traceResult.sideHit.getOpposite());
if (player.canPlayerEdit(pos, traceResult.sideHit, stack)) {
FluidActionResult result = FluidUtil.tryPickUpFluid(stack, player, world, pos, traceResult.sideHit);
if (result.isSuccess() && !player.capabilities.isCreativeMode) {
player.addStat(StatList.getObjectUseStats(this));
return ActionResult.newResult(EnumActionResult.SUCCESS, result.getResult());
Expand All @@ -250,8 +249,7 @@ ActionResult<ItemStack> doBucketEmpty(ItemStack stack, @Nonnull World world, @No
BlockPos pos = traceResult.getBlockPos();
if (world.isBlockModifiable(player, pos)) {
BlockPos targetPos = pos.offset(traceResult.sideHit);

if (player.canPlayerEdit(targetPos, traceResult.sideHit, stack)) {
if (player.canPlayerEdit(targetPos, traceResult.sideHit.getOpposite(), stack)) {
FluidActionResult result = FluidUtil.tryPlaceFluid(player, world, targetPos, stack, new FluidStack(getFluid(stack), Fluid.BUCKET_VOLUME));
if (result.isSuccess() && !player.capabilities.isCreativeMode) {
player.addStat(StatList.getObjectUseStats(this));
Expand Down
Loading

0 comments on commit fbc1b24

Please sign in to comment.