Skip to content

Commit

Permalink
barrel improvements, update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Feb 19, 2017
1 parent c04c08b commit 783bce3
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ configurations {
}

dependencies {
deobfCompile "MCMultiPart2:MCMultiPart-exp:2.0.0_11:universal"
deobfCompile "MCMultiPart2:MCMultiPart-exp:2.0.0_16"
deobfCompile "mezz.jei:jei_1.11.2:4.2.6.237"
deobfCompile "org.cyclops.commoncapabilities:CommonCapabilities:1.11.2-1.3.1-95"
shadow name: "libresample4j", version: "bc0a030"
Expand Down
7 changes: 6 additions & 1 deletion changelog/0.4.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
* One mod ID with modules (higher granularity than previously) configurable in config/charset/modules.
* The above, of course, makes "@Charset" work in JEI.
* [audio.tapes] Temporaily removed due to a potential incoming redesign. That's the only breaking part of this update - sorry!
* [audio.transport] New module - adds Audio Cables (requires MCMultiPart2)
* [lib] [#123] Work around issues with mods which change wood recipes, like BetterWithMods
* [misc.drama] [#120] Fix IllegalArgumentException
* [misc.scaffolds] Improved JEI support.
* [pipes] [#121] Fix Shifter crashes
* [pipes] Add support for CommonCapabilities' IInventoryState for further optimizations.
* [pipes] Added support for CommonCapabilities' IInventoryState for further optimizations.
* [pipes] Added MCMultiPart2 support.
* [storage.barrels] Added support for locking Hopping Barrels with a redstone signal.
* [storage.barrels] Added MCMultiPart2 support.
* [storage.barrels] Fixed Creative Barrel behaviour on stack insertion.
* [storage.barrels] Fixed many issues with barrel carts.
* [storage.barrels] Improved JEI support.
* [storage.barrels] Sticky barrel upgrade can now use OreDict-ed slimeballs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static <T> T get(World world, BlockPos pos, Capability<T> capability, Enu
return result;
}

if (entities) {
if (entities && !world.isSideSolid(pos, facing, false)) {
List<Entity> entityList = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos));
for (Entity entity : entityList) {
T result = get(capability, entity, facing);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/pl/asie/charset/lib/material/ItemMaterial.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package pl.asie.charset.lib.material;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.INBTSerializable;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import net.minecraftforge.items.IItemHandler;
import pl.asie.charset.api.lib.IAxisRotatable;
import pl.asie.charset.ModCharset;
import pl.asie.charset.api.pipes.IShifter;
import pl.asie.charset.lib.blocks.TileBase;
import pl.asie.charset.lib.capability.Capabilities;
import pl.asie.charset.lib.capability.CapabilityHelper;
Expand All @@ -70,8 +71,12 @@
import pl.asie.charset.lib.utils.ItemUtils;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.RayTraceUtils;
import pl.asie.charset.lib.utils.RedstoneUtils;
import pl.asie.charset.lib.utils.SpaceUtils;
import pl.asie.charset.pipes.PipeUtils;
import pl.asie.charset.pipes.pipe.TilePipe;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.WeakHashMap;
Expand Down Expand Up @@ -203,6 +208,9 @@ public boolean isHopping() {
return this == HOPPING || this == CREATIVE;
}
}

private boolean updateRedstoneLevels;
private int redstoneLevel;
private int last_mentioned_count = -1;

public TileEntityDayBarrel() {
Expand Down Expand Up @@ -230,6 +238,22 @@ public void readNBTData(NBTTagCompound compound, boolean isClient) {
markBlockForRenderUpdate();
}

@Override
public void validate() {
super.validate();
updateRedstoneLevels = true;
}

public void updateRedstoneLevel() {
redstoneLevel = 0;
for (EnumFacing d : EnumFacing.VALUES) {
if (isTop(d) || isTop(d.getOpposite()))
continue;

redstoneLevel = Math.max(redstoneLevel, RedstoneUtils.getRedstonePower(world, pos.offset(d), d));
}
}

@Override
public NBTTagCompound writeNBTData(NBTTagCompound compound, boolean isClient) {
ItemUtils.writeToNBT(item, compound, "item");
Expand All @@ -253,7 +277,12 @@ public void update() {
return;
}

if (!scheduledTick || (getWorld().getTotalWorldTime() % getLogicSpeed()) != 0) {
if (updateRedstoneLevels) {
updateRedstoneLevel();
updateRedstoneLevels = false;
}

if (redstoneLevel > 0 || !scheduledTick || (getWorld().getTotalWorldTime() % getLogicSpeed()) != 0) {
return;
}

Expand Down Expand Up @@ -305,7 +334,9 @@ void tick() {
for (int i = 0; i < handler.getSlots(); i++) {
ItemStack got = handler.insertItem(i, toPush, false);
if (got.isEmpty()) {
item.shrink(1);
if (type != Type.CREATIVE) {
item.shrink(1);
}
itemChanged = true;
break;
}
Expand All @@ -323,9 +354,12 @@ private void needLogic() {
}

public void neighborChanged(BlockPos pos, BlockPos fromPos) {
// X/Z can be equal, as we only care about top/bottom neighbors
if (type.isHopping() && pos.getX() == fromPos.getX() && pos.getZ() == fromPos.getZ()) {
needLogic();
if (type.isHopping()) {
updateRedstoneLevel();
// X/Z can be equal, as we only care about top/bottom neighbors for this
if (pos.getX() == fromPos.getX() && pos.getZ() == fromPos.getZ()) {
needLogic();
}
}
}

Expand Down

0 comments on commit 783bce3

Please sign in to comment.