Skip to content

Commit

Permalink
fix step height enchant by porting 1.16 flag. melter likes buckets no…
Browse files Browse the repository at this point in the history
…w. add rooted dirt recipe
  • Loading branch information
Lothrazar committed Dec 11, 2024
1 parent 5eb0bfd commit 8f5bb80
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 29 deletions.
2 changes: 1 addition & 1 deletion examples/config/cyclic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
#####################################################################################
[cyclic.logging]
# Unblock info logs; very spammy; can be useful for testing certain issues
info = false
info = true

#####################################################################################
# Item specific configs
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
c# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# as needed run/server.properties : online-mode=false

mod_id=cyclic

mod_version=1.13.2
mod_version=1.13.3

curse_id=239286

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/lothrazar/cyclic/ModCyclic.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ public ModCyclic() {
LootModifierRegistry.LOOT.register(bus);
ForgeMod.enableMilkFluid();
}

public static void log(String string) {
LOGGER.info(string);
}
}
11 changes: 6 additions & 5 deletions src/main/java/com/lothrazar/cyclic/block/melter/BlockMelter.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class BlockMelter extends BlockCyclic {
public BlockMelter(Properties properties) {
super(properties.strength(1.2F).noOcclusion());
this.setHasGui();
this.setHasFluidInteract();
}

@Override
Expand Down Expand Up @@ -61,6 +62,11 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, Block
return createTickerHelper(type, TileRegistry.MELTER.get(), world.isClientSide ? TileMelter::clientTick : TileMelter::serverTick);
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(LIT);
}

@Override
public boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter world, BlockPos pos, FluidState fluidState) {
return true;
Expand All @@ -70,9 +76,4 @@ public boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter wo
public void registerClient() {
MenuScreens.register(MenuTypeRegistry.MELTER.get(), ScreenMelter::new);
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(LIT);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.lothrazar.cyclic.block.melter;

import java.util.List;
import java.util.function.Predicate;
import com.lothrazar.cyclic.block.TileBlockEntityCyclic;
import com.lothrazar.cyclic.capabilities.block.FluidTankBase;
import com.lothrazar.cyclic.registry.BlockRegistry;
Expand Down Expand Up @@ -40,7 +39,7 @@ static enum Fields {
static final int MAX = 64000;
public static final int CAPACITY = 64 * FluidType.BUCKET_VOLUME;
public static final int TRANSFER_FLUID_PER_TICK = FluidType.BUCKET_VOLUME / 20;
public FluidTankBase tank = new FluidTankBase(this, CAPACITY, isFluidValid());
FluidTankBase tank = new FluidTankBase(this, CAPACITY, p -> true);
CustomEnergyStorage energy = new CustomEnergyStorage(MAX, MAX);
ItemStackHandler inventory = new ItemStackHandler(2);
private LazyOptional<IEnergyStorage> energyCap = LazyOptional.of(() -> energy);
Expand Down Expand Up @@ -128,10 +127,6 @@ public int getField(int field) {
return 0;
}

public Predicate<FluidStack> isFluidValid() {
return p -> true;
}

@Override
public Component getDisplayName() {
return BlockRegistry.MELTER.get().getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static enum Fields {
public static final int CAPACITY = 64 * FluidType.BUCKET_VOLUME;
public static final int TRANSFER_FLUID_PER_TICK = FluidType.BUCKET_VOLUME / 20;
private RecipeSolidifier currentRecipe;
FluidTankBase tank;
FluidTankBase tank = new FluidTankBase(this, CAPACITY, p -> true);
ItemStackHandler inputSlots = new ItemStackHandler(3);
ItemStackHandler outputSlots = new ItemStackHandler(1);
private ItemStackHandlerWrapper inventory = new ItemStackHandlerWrapper(inputSlots, outputSlots);
Expand All @@ -52,7 +52,7 @@ static enum Fields {

public TileSolidifier(BlockPos pos, BlockState state) {
super(TileRegistry.SOLIDIFIER.get(), pos, state);
tank = new FluidTankBase(this, CAPACITY, p -> true);

}

public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, TileSolidifier e) {
Expand Down Expand Up @@ -230,9 +230,7 @@ private boolean tryProcessRecipe() {
inputSlots.getStackInSlot(0).shrink(1);
inputSlots.getStackInSlot(1).shrink(1);
inputSlots.getStackInSlot(2).shrink(1);
// if (!level.isClientSide()) { // only drain serverside to avoid desync issues # not needed anymore with above fix
tank.drain(this.currentRecipe.fluidIngredient.getAmount(), FluidAction.EXECUTE);
// }
outputSlots.insertItem(0, currentRecipe.getResultItem(level.registryAccess()), false);
updateComparatorOutputLevel();
return true;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/lothrazar/cyclic/enchant/StepEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,19 @@ public void onEntityUpdate(LivingTickEvent event) {
int level = 0;
if (armor.isEmpty() == false && EnchantmentHelper.getEnchantments(armor) != null
&& EnchantmentHelper.getEnchantments(armor).containsKey(this)) {
//todo: maybe any armor?
level = EnchantmentHelper.getEnchantments(armor).get(this);
}
if (level > 0) {
turnOn(player, armor);
}
else {
// ModCyclic.log(" level " + level + " and " + armor.getOrCreateTag().getBoolean(NBT_ON));
turnOff(player, armor);
}
}

private void turnOn(Player player, ItemStack armor) {
player.getPersistentData().putBoolean(NBT_ON, true);
AttributesUtil.enableStepHeight(player);
// ModCyclic.log("ON " + player.getPersistentData().getBoolean(NBT_ON));
}

private void turnOff(Player player, ItemStack armor) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/lothrazar/cyclic/enchant/TravellerEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ public void onEntityUpdate(LivingDamageEvent event) {
}
int level = getCurrentArmorLevelSlot(event.getEntity(), EquipmentSlot.LEGS);
DamageSource source = event.getSource(); // .type();
DamageSources bullshit = event.getEntity().level().damageSources();
if (level > 0 && (source == bullshit.cactus()
|| source == bullshit.flyIntoWall()
|| source == bullshit.sweetBerryBush()
|| source == bullshit.sting(null))) {
DamageSources sourcesList = event.getEntity().level().damageSources();
if (level > 0 && (source == sourcesList.cactus()
|| source == sourcesList.flyIntoWall()
|| source == sourcesList.sweetBerryBush()
|| source == sourcesList.sting(null))) {
event.setAmount(0.1F);
}
if (level > 0 && source == bullshit.fall()) {
if (level > 0 && source == sourcesList.fall()) {
//normal is zero damage up to 3 distance. 1 damage (half heart) at 4 distance. and each distance up goes up by that
// so 8 fall damage would be 5 damage
if (event.getEntity().fallDistance <= 8) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/lothrazar/cyclic/filesystem/CyclicFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class CyclicFile {
public boolean storageVisible = false;
public boolean todoVisible = false;
public boolean stepHeight = false;
public boolean stepHeightForceOff; // revived the latch used in 1.16.5
public List<String> todoTasks = new ArrayList<>();
public int spectatorTicks = 0;
// first 27 slots are for inventory cake storage. remaining unused
Expand All @@ -36,6 +37,7 @@ public void read(CompoundTag tag) {
spectatorTicks = tag.getInt("spectatorTicks");
storageVisible = tag.getBoolean("storageVisible");
stepHeight = tag.getBoolean("stepHeight");
stepHeightForceOff = tag.getBoolean("stepHeightForceOff");
if (tag.contains("tasks")) {
ListTag glist = tag.getList("tasks", Tag.TAG_COMPOUND);
for (int i = 0; i < glist.size(); i++) {
Expand All @@ -50,6 +52,7 @@ public CompoundTag write() {
tag.put(NBTINV, inventory.serializeNBT());
tag.putInt("spectatorTicks", spectatorTicks);
tag.putBoolean("stepHeight", stepHeight);
tag.putBoolean("stepHeightForceOff", stepHeightForceOff);
tag.putBoolean("storageVisible", storageVisible);
ListTag glist = new ListTag();
int i = 0;
Expand All @@ -65,5 +68,8 @@ public CompoundTag write() {

public void toggleStepHeight() {
this.stepHeight = !this.stepHeight;
if (!this.stepHeight) {
this.stepHeightForceOff = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lothrazar.cyclic.item.food;

import com.lothrazar.cyclic.ModCyclic;
import com.lothrazar.cyclic.event.PlayerDataEvents;
import com.lothrazar.cyclic.filesystem.CyclicFile;
import com.lothrazar.cyclic.item.ItemBaseCyclic;
Expand Down Expand Up @@ -58,7 +59,9 @@ public static void onUpdate(Player player) {
AttributesUtil.enableStepHeight(player);
}
else {
AttributesUtil.disableStepHeight(player);
if (datFile.stepHeightForceOff) {
AttributesUtil.disableStepHeight(player);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"tag": "forge:gravel"
}],
"mix": {
"fluid": "minecraft:water",
"tag": "forge:biomass",
"count": 1000
},
"energy": {
Expand Down
20 changes: 20 additions & 0 deletions src/main/resources/data/cyclic/recipes/solidifier/rooted_dirt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "cyclic:solidifier",
"ingredients":[{
"item": "minecraft:dirt"
},{
"tag": "minecraft:leaves"
}],
"mix": {
"tag": "forge:biomass",
"count": 50
},
"energy": {
"rfpertick": 500,
"ticks": 20
},
"result": {
"item": "minecraft:rooted_dirt",
"count": 1
}
}
1 change: 1 addition & 0 deletions update.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@

,"1.13.1":"Fixed some visual glitches"
,"1.13.2":"Fix patchouli Guidebook doesn't show in JEI (and creative tab). Fix Sleeping Bag Disconnect with fully charged bow #2446. Two recipes have updated to use tag-ingredients forge:storage_blocks/ender_eye forge:storage_blocks/ender_pearl instead of item ids (this makes no difference to players experience). Re-added/Ported the alternate recipe for Tempered Dark Glass using obsidian and black stained glass"
,"1.13.3":"You can now use a bucket on the Melter machine. Fix Step Height enchantment. Add recipe in the Solidifier for Rooted Dirt"
}
}

0 comments on commit 8f5bb80

Please sign in to comment.