Server-side and Migration crashes

- Fixed crash on server start-up
- Fixed internal server error when equipping a blockzapper
- "Fixed" belts not behaving when migrated from 0.1 (destroying them)
- Fixed Saws not having a kill message
- Fixed Drill not damaging entities
- Added recipe for the storage interface
This commit is contained in:
simibubi 2020-03-09 01:06:34 +01:00
parent 71c65615bc
commit 15680a6c0b
7 changed files with 68 additions and 10 deletions

View file

@ -4,6 +4,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public enum ScreenResources {
@ -169,8 +171,6 @@ public enum ScreenResources {
public final ResourceLocation location;
public int width, height;
public int startX, startY;
static Screen renderer = new Screen(null) {
};
private ScreenResources(String location, int width, int height) {
this(location, 0, 0, width, height);
@ -188,17 +188,21 @@ public enum ScreenResources {
this.startY = startY;
}
@OnlyIn(Dist.CLIENT)
public void bind() {
Minecraft.getInstance().getTextureManager().bindTexture(location);
}
@OnlyIn(Dist.CLIENT)
public void draw(AbstractGui screen, int x, int y) {
bind();
screen.blit(x, y, startX, startY, width, height);
}
@OnlyIn(Dist.CLIENT)
public void draw(int x, int y) {
draw(renderer, x, y);
draw(new Screen(null) {
}, x, y);
}
}

View file

@ -10,10 +10,15 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
@ -23,6 +28,7 @@ import net.minecraft.world.World;
public class DrillBlock extends DirectionalKineticBlock implements IPortableBlock, IWithTileEntity<DrillTileEntity> {
public static MovementBehaviour MOVEMENT = new DrillMovementBehaviour();
public static DamageSource damageSourceDrill = new DamageSource("create.drill").setDamageBypassesArmor();
public DrillBlock() {
super(Properties.from(Blocks.IRON_BLOCK));
@ -33,6 +39,19 @@ public class DrillBlock extends DirectionalKineticBlock implements IPortableBloc
return true;
}
@Override
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (entityIn instanceof ItemEntity)
return;
if (!new AxisAlignedBB(pos).shrink(.1f).intersects(entityIn.getBoundingBox()))
return;
withTileEntityDo(worldIn, pos, te -> {
if (te.getSpeed() == 0)
return;
entityIn.attackEntityFrom(damageSourceDrill, MathHelper.clamp(Math.abs(te.getSpeed() / 32f) + 1, 0, 20));
});
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new DrillTileEntity();

View file

@ -88,7 +88,7 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IWithTileEn
withTileEntityDo(worldIn, pos, te -> {
if (te.getSpeed() == 0)
return;
entityIn.attackEntityFrom(damageSourceSaw, MathHelper.clamp(Math.abs(te.getSpeed() / 512f) + 1, 0, 20));
entityIn.attackEntityFrom(damageSourceSaw, MathHelper.clamp(Math.abs(te.getSpeed() / 32f) + 1, 0, 20));
});
}

View file

@ -65,6 +65,15 @@ public class BeltTileEntity extends KineticTileEntity {
index = -1;
}
@Override
public void initialize() {
super.initialize();
// 0.1 belt
if (beltLength == 0) {
world.destroyBlock(pos, true);
}
}
@Override
public void tick() {
super.tick();

View file

@ -30,6 +30,7 @@ public class TerrainzapperItem extends ZapperItem implements IHaveCustomItemMode
}
@Override
@OnlyIn(value = Dist.CLIENT)
protected void openHandgunGUI(ItemStack item, boolean b) {
ScreenOpener.open(new TerrainzapperScreen(item, b));
}

View file

@ -273,6 +273,7 @@
"death.attack.create.fan_fire": "%1$s was burned to death by hot air",
"death.attack.create.fan_lava": "%1$s was burned to death by lava fan",
"death.attack.create.drill": "%1$s was impaled by Mechanical Drill",
"death.attack.create.saw": "%1$s got cut in half by Mechanical Saw",
"create.block.deployer.damage_source_name": "a rogue Deployer",
"death.attack.create.curse_polish": "%1$s tried to polish a cursed item",
"death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock",

View file

@ -0,0 +1,24 @@
{
"type": "crafting_shaped",
"pattern": [
"LT"
],
"key": {
"L": {
"item": "create:andesite_casing"
},
"T": {
"item": "create:extractor"
}
},
"result": {
"item": "create:portable_storage_interface",
"count": 1
},
"conditions": [
{
"type": "create:module",
"module": "contraptions"
}
]
}