Bug Fixes

- Sandpaper can no longer repair tools
- Fixed players getting kicked for "flying" when moved by contraptions or fans
- Saw no longer duplicates itself when broken in an overstressed state
- Belts can no longer pass items on to a vertical belt
This commit is contained in:
simibubi 2020-04-11 00:55:51 +02:00
parent 3c0b55ac1d
commit 4d16961636
11 changed files with 20 additions and 51 deletions

View file

@ -21,6 +21,7 @@ sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = co
minecraft { minecraft {
mappings channel: 'snapshot', version: '20200119-1.14.3' mappings channel: 'snapshot', version: '20200119-1.14.3'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs { runs {
client { client {

View file

@ -11,7 +11,6 @@ public class CCuriosities extends ConfigBase {
public ConfigBool enableRefinedRadianceRecipe = b(true, "enableRefinedRadianceRecipe", public ConfigBool enableRefinedRadianceRecipe = b(true, "enableRefinedRadianceRecipe",
Comments.refinedRadianceRecipe); Comments.refinedRadianceRecipe);
public ConfigBool enableShadowSteelRecipe = b(true, "enableShadowSteelRecipe", Comments.shadowSteelRecipe); public ConfigBool enableShadowSteelRecipe = b(true, "enableShadowSteelRecipe", Comments.shadowSteelRecipe);
public ConfigBool enableSandPaperToolPolishing = b(true, "enableSandPaperToolPolishing", Comments.sandPaperOnTools);
public ConfigFloat cocoaLogGrowthSpeed = f(20, 0, 100, "cocoaLogGrowthSpeed", Comments.cocoa); public ConfigFloat cocoaLogGrowthSpeed = f(20, 0, 100, "cocoaLogGrowthSpeed", Comments.cocoa);
@Override @Override
@ -24,7 +23,6 @@ public class CCuriosities extends ConfigBase {
static String refinedRadiance = "The amount of Light sources destroyed before Chromatic Compound turns into Refined Radiance."; static String refinedRadiance = "The amount of Light sources destroyed before Chromatic Compound turns into Refined Radiance.";
static String refinedRadianceRecipe = "Allow the standard Refined Radiance recipes."; static String refinedRadianceRecipe = "Allow the standard Refined Radiance recipes.";
static String shadowSteelRecipe = "Allow the standard Shadow Steel recipe."; static String shadowSteelRecipe = "Allow the standard Shadow Steel recipe.";
static String sandPaperOnTools = "Enable the tool repairing mechanic involving sand paper.";
static String windowsInBlocks = "Allow Glass Panes to be put inside Blocks like Stairs, Slabs, Fences etc."; static String windowsInBlocks = "Allow Glass Panes to be put inside Blocks like Stairs, Slabs, Fences etc.";
static String cocoa = "% of random Ticks causing a Cocoa log to grow."; static String cocoa = "% of random Ticks causing a Cocoa log to grow.";
static String zapperUndoLogLength = "The maximum amount of operations, a blockzapper can remember for undoing. (0 to disable undo)"; static String zapperUndoLogLength = "The maximum amount of operations, a blockzapper can remember for undoing. (0 to disable undo)";

View file

@ -14,6 +14,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.IProjectile; import net.minecraft.entity.IProjectile;
import net.minecraft.entity.MoverType; import net.minecraft.entity.MoverType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Direction.AxisDirection;
@ -73,6 +74,7 @@ public class ContraptionCollider {
if (allowedMovement.equals(relativeMotion)) if (allowedMovement.equals(relativeMotion))
continue; continue;
if (allowedMovement.y != relativeMotion.y) { if (allowedMovement.y != relativeMotion.y) {
entity.fall(entity.fallDistance, 1); entity.fall(entity.fallDistance, 1);
entity.fallDistance = 0; entity.fallDistance = 0;
@ -80,6 +82,8 @@ public class ContraptionCollider {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> checkForClientPlayerCollision(entity)); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> checkForClientPlayerCollision(entity));
} }
if (entity instanceof ServerPlayerEntity)
((ServerPlayerEntity) entity).connection.floatingTickCount = 0;
if (entity instanceof PlayerEntity && !world.isRemote) if (entity instanceof PlayerEntity && !world.isRemote)
return; return;

View file

@ -18,6 +18,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -95,6 +96,9 @@ public class AirCurrent {
entity.setMotion(previousMotion.add(new Vec3d(xIn, yIn, zIn).scale(1 / 8f))); entity.setMotion(previousMotion.add(new Vec3d(xIn, yIn, zIn).scale(1 / 8f)));
entity.fallDistance = 0; entity.fallDistance = 0;
if (entity instanceof ServerPlayerEntity)
((ServerPlayerEntity) entity).connection.floatingTickCount = 0;
if (InWorldProcessing.isFrozen()) if (InWorldProcessing.isFrozen())
return; return;

View file

@ -135,7 +135,7 @@ public class SawBlock extends DirectionalAxisKineticBlock implements ITE<SawTile
withTileEntityDo(worldIn, pos, te -> ItemHelper.dropContents(worldIn, pos, te.inventory)); withTileEntityDo(worldIn, pos, te -> ItemHelper.dropContents(worldIn, pos, te.inventory));
TileEntityBehaviour.destroy(worldIn, pos, FilteringBehaviour.TYPE); TileEntityBehaviour.destroy(worldIn, pos, FilteringBehaviour.TYPE);
worldIn.removeTileEntity(pos); worldIn.removeTileEntity(pos);
} }
@Override @Override

View file

@ -55,6 +55,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
private int recipeIndex; private int recipeIndex;
private LazyOptional<IItemHandler> invProvider = LazyOptional.empty(); private LazyOptional<IItemHandler> invProvider = LazyOptional.empty();
private FilteringBehaviour filtering; private FilteringBehaviour filtering;
private boolean destroyed;
public SawTileEntity() { public SawTileEntity() {
super(AllTileEntities.SAW.type); super(AllTileEntities.SAW.type);
@ -81,7 +82,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
super.onSpeedChanged(prevSpeed); super.onSpeedChanged(prevSpeed);
boolean shouldRun = Math.abs(getSpeed()) > 1 / 64f; boolean shouldRun = Math.abs(getSpeed()) > 1 / 64f;
boolean running = getBlockState().get(RUNNING); boolean running = getBlockState().get(RUNNING);
if (shouldRun != running) if (shouldRun != running && !destroyed)
world.setBlockState(pos, getBlockState().with(RUNNING, shouldRun), 2 | 16); world.setBlockState(pos, getBlockState().with(RUNNING, shouldRun), 2 | 16);
} }
@ -212,8 +213,9 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
@Override @Override
public void remove() { public void remove() {
super.remove();
invProvider.invalidate(); invProvider.invalidate();
destroyed = true;
super.remove();
} }
@Override @Override

View file

@ -245,7 +245,7 @@ public class BeltInventory {
} }
// next block is not a belt // next block is not a belt
if (!AllBlocks.BELT.typeOf(state)) { if (!AllBlocks.BELT.typeOf(state) || state.get(BeltBlock.SLOPE) == Slope.VERTICAL) {
if (!Block.hasSolidSide(state, world, nextPosition, movementFacing.getOpposite())) { if (!Block.hasSolidSide(state, world, nextPosition, movementFacing.getOpposite())) {
eject(current); eject(current);
iterator.remove(); iterator.remove();

View file

@ -9,7 +9,6 @@ import com.simibubi.create.modules.curiosities.tools.SandPaperItemRenderer.SandP
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -111,7 +110,7 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel {
@Override @Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
return enchantment == Enchantments.FORTUNE || super.canApplyAtEnchantingTable(stack, enchantment); return super.canApplyAtEnchantingTable(stack, enchantment);
} }
@Override @Override

View file

@ -1,25 +1,18 @@
package com.simibubi.create.modules.curiosities.tools; package com.simibubi.create.modules.curiosities.tools;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import com.simibubi.create.AllRecipes; import com.simibubi.create.AllRecipes;
import com.simibubi.create.config.AllConfigs;
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient; import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput; import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe; import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.modules.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv; import com.simibubi.create.modules.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion.Mode;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper; import net.minecraftforge.items.wrapper.RecipeWrapper;
@ -34,46 +27,13 @@ public class SandPaperPolishingRecipe extends ProcessingRecipe<SandPaperInv> {
} }
public static boolean canPolish(World world, ItemStack stack) { public static boolean canPolish(World world, ItemStack stack) {
return (stack.isDamageable() && isPolishingEnabled()) || !getMatchingRecipes(world, stack).isEmpty(); return !getMatchingRecipes(world, stack).isEmpty();
}
public static Boolean isPolishingEnabled() {
return AllConfigs.SERVER.curiosities.enableSandPaperToolPolishing.get();
} }
public static ItemStack applyPolish(World world, Vec3d position, ItemStack stack, ItemStack sandPaperStack) { public static ItemStack applyPolish(World world, Vec3d position, ItemStack stack, ItemStack sandPaperStack) {
List<IRecipe<SandPaperInv>> matchingRecipes = getMatchingRecipes(world, stack); List<IRecipe<SandPaperInv>> matchingRecipes = getMatchingRecipes(world, stack);
if (!matchingRecipes.isEmpty()) if (!matchingRecipes.isEmpty())
return matchingRecipes.get(0).getCraftingResult(new SandPaperInv(stack)).copy(); return matchingRecipes.get(0).getCraftingResult(new SandPaperInv(stack)).copy();
if (stack.isDamageable() && isPolishingEnabled()) {
stack.setDamage(stack.getDamage() / 2);
int fortuneLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, sandPaperStack);
float chanceToPunish = (float) (1 / Math.pow(2, fortuneLevel + 1));
if (world.rand.nextFloat() > chanceToPunish)
return stack;
if (stack.isEnchanted()) {
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(stack);
ArrayList<Enchantment> list = new ArrayList<>(enchantments.keySet());
Enchantment randomKey = list.get(world.rand.nextInt(list.size()));
int level = enchantments.get(randomKey);
if (level <= 1)
enchantments.remove(randomKey);
else
enchantments.put(randomKey, level - 1);
EnchantmentHelper.setEnchantments(enchantments, stack);
if (randomKey.isCurse())
if (!world.isRemote)
world.createExplosion(null, CURSED_POLISHING, position.x, position.y, position.z, 2, true,
Mode.DESTROY);
} else {
stack = ItemStack.EMPTY;
}
}
return stack; return stack;
} }

View file

@ -0,0 +1 @@
public net.minecraft.network.play.ServerPlayNetHandler field_147365_f # floatingTickCount

View file

@ -943,7 +943,7 @@
"block.create.clockwork_bearing.tooltip": "CLOCKWORK BEARING", "block.create.clockwork_bearing.tooltip": "CLOCKWORK BEARING",
"block.create.clockwork_bearing.tooltip.summary": "An advanced version of the _Mechanical_ _Bearing_ for rotating up to two _clock_ _hands_ according to current _in-game_ _time_.", "block.create.clockwork_bearing.tooltip.summary": "An advanced version of the _Mechanical_ _Bearing_ for rotating up to two _clock_ _hands_ according to current _in-game_ _time_.",
"block.create.clockwork_bearing.tooltip.condition1": "When Rotated", "block.create.clockwork_bearing.tooltip.condition1": "When Rotated",
"block.create.clockwork_bearing.tooltip.behaviour1": "Starts rotating the attached Structure towards the _current_ _hour_. If a second structure is present, it will serve as the _minute_ _hand_.", "block.create.clockwork_bearing.tooltip.behaviour1": "Starts rotating the attached Structure towards the _current_ _hour_. If an independent second structure exists in front of the first one, it will serve as the _minute_ _hand_.",
"block.create.sequenced_gearshift.tooltip": "SEQUENCED GEARSHIFT", "block.create.sequenced_gearshift.tooltip": "SEQUENCED GEARSHIFT",
"block.create.sequenced_gearshift.tooltip.summary": "A _programmable_ _utility_ _component,_ which can change its _rotational_ _through-put_ according to up to _5_ _consecutive_ _instructions._ Use this to power Mechanical Bearings, Pistons or Pulleys with more control over timing and speed. May become less precise at higher speeds.", "block.create.sequenced_gearshift.tooltip.summary": "A _programmable_ _utility_ _component,_ which can change its _rotational_ _through-put_ according to up to _5_ _consecutive_ _instructions._ Use this to power Mechanical Bearings, Pistons or Pulleys with more control over timing and speed. May become less precise at higher speeds.",
@ -1131,7 +1131,7 @@
"block.create.stress_gauge.tooltip.behaviour1": "Indicates a color corresponding to the level of stress. _Over-stressed_ _networks_ will cease to move. Stress can be relieved by adding more _rotational_ _sources_ to the network.", "block.create.stress_gauge.tooltip.behaviour1": "Indicates a color corresponding to the level of stress. _Over-stressed_ _networks_ will cease to move. Stress can be relieved by adding more _rotational_ _sources_ to the network.",
"tool.create.sand_paper.tooltip": "SAND PAPER", "tool.create.sand_paper.tooltip": "SAND PAPER",
"tool.create.sand_paper.tooltip.summary": "A rough paper that can be used to _polish_ _materials_ or sharpen your _tools_.", "tool.create.sand_paper.tooltip.summary": "A rough paper that can be used to _polish_ _materials_. Can be automatically applied using the Deployer.",
"tool.create.sand_paper.tooltip.condition1": "When Used", "tool.create.sand_paper.tooltip.condition1": "When Used",
"tool.create.sand_paper.tooltip.behaviour1": "Applies polish to items held in the _offhand_ or lying on the _floor_ when _looking_ _at_ _them_", "tool.create.sand_paper.tooltip.behaviour1": "Applies polish to items held in the _offhand_ or lying on the _floor_ when _looking_ _at_ _them_",