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 {
@ -39,7 +41,7 @@ public enum ScreenResources {
FILTER("filter.png", 200, 100),
ATTRIBUTE_FILTER("filter.png", 0, 100, 200, 86),
// Logistical Index
INDEX_TOP("index.png", 41, 0, 174, 22),
INDEX_TOP_TRIM("index.png", 41, 22, 174, 6),
@ -111,7 +113,7 @@ public enum ScreenResources {
I_WHITELIST_NOT(12, 0),
I_RESPECT_NBT(13, 0),
I_IGNORE_NBT(14, 0),
I_CONFIRM(0, 1),
I_NONE(1, 1),
I_OPEN_FOLDER(2, 1),
@ -124,7 +126,7 @@ public enum ScreenResources {
I_MOVE_PLACE(9, 1),
I_MOVE_PLACE_RETURNED(10, 1),
I_MOVE_NEVER_PLACE(11, 1),
I_DONT_REPLACE(0, 2),
I_REPLACE_SOLID(1, 2),
I_REPLACE_ANY(2, 2),
@ -142,7 +144,7 @@ public enum ScreenResources {
I_TOOL_DEPLOY(0, 3),
I_SKIP_TILES(2, 3),
I_SKIP_MISSING(1, 3),
I_TOOL_MOVE_XZ(0, 4),
I_TOOL_MOVE_Y(1, 4),
I_TOOL_ROTATE(2, 4),
@ -156,12 +158,12 @@ public enum ScreenResources {
I_PATTERN_CHECKERED(1, 6),
I_PATTERN_CHECKERED_INVERSED(2, 6),
I_PATTERN_CHANCE_25(3, 6),
I_PATTERN_CHANCE_50(0, 7),
I_PATTERN_CHANCE_75(1, 7),
I_FOLLOW_DIAGONAL(2, 7),
I_FOLLOW_MATERIAL(3, 7),
;
public static final int FONT_COLOR = 0x575F7A;
@ -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"
}
]
}