Skip to content

Commit

Permalink
2.7.1
Browse files Browse the repository at this point in the history
Changed some internal stuff so Piece Sets more accurately reflect their base block, and fixed some crashes in the meantime.

Note: Redstone Ore Pieces act very strangely. This is better than they used to act, however, which was just crashing the game.
  • Loading branch information
Shnupbups committed Sep 1, 2019
1 parent 14b3b45 commit 5494b5b
Show file tree
Hide file tree
Showing 14 changed files with 976 additions and 121 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ org.gradle.jvmargs=-Xmx1G
# check on modmuss' website https://modmuss50.me/fabric.html
minecraft_version=1.14.4
yarn_mappings=1.14.4+build.12
loader_version=0.6.1+build.164
loader_version=0.6.1+build.165

# Mod Properties
mod_version = 2.7.0
mod_version = 2.7.1
maven_group = com.shnupbups
archives_base_name = extrapieces

Expand All @@ -24,7 +24,7 @@ org.gradle.jvmargs=-Xmx1G

# Other Stuff
# check on maven at https://maven.fabricmc.net/me/shedaniel/RoughlyEnoughItems/
rei_version=3.1-pre+build.4
rei_version=3.1.1+build.8

# check on maven at https://maven.fabricmc.net/io/github/prospector/modmenu/
modmenu_version=1.7.9+build.118
modmenu_version=1.7.10+build.119
110 changes: 98 additions & 12 deletions src/main/java/com/shnupbups/extrapieces/blocks/ColumnPieceBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
Expand All @@ -16,13 +17,16 @@
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.IWorld;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;

import java.util.Random;

Expand Down Expand Up @@ -123,30 +127,112 @@ public FluidState getFluidState(BlockState blockState_1) {
public boolean canPlaceAtSide(BlockState blockState_1, BlockView blockView_1, BlockPos blockPos_1, BlockPlacementEnvironment blockPlacementEnvironment_1) {
return false;
}

@Environment(EnvType.CLIENT)
@Override
public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) {
this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1);
super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1);
try {
this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) {
this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1);
super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1);
try {
this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) {
this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1);
super.onBroken(iWorld_1, blockPos_1, blockState_1);
try {
this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public float getBlastResistance() {
return this.set.getBase().getBlastResistance();
try {
return this.getBase().getBlastResistance();
} catch (IllegalArgumentException ignored) {
return super.getBlastResistance();
}
}


@Override
public BlockRenderLayer getRenderLayer() {
return this.set.getBase().getRenderLayer();
try {
return this.getBase().getRenderLayer();
} catch (IllegalArgumentException ignored) {
return super.getRenderLayer();
}
}


@Override
public int getTickRate(ViewableWorld viewableWorld_1) {
return this.set.getBase().getTickRate(viewableWorld_1);
try {
return this.getBase().getTickRate(viewableWorld_1);
} catch (IllegalArgumentException ignored) {
return super.getTickRate(viewableWorld_1);
}
}

@Override
public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) {
super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1);
try {
if (blockState_1.getBlock() != blockState_1.getBlock()) {
this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false);
this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false);
}
} catch (IllegalArgumentException ignored) {}
}

@Override
public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) {
super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1);
try {
if (blockState_1.getBlock() != blockState_2.getBlock()) {
this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1);
}
} catch (IllegalArgumentException ignored) {}
}

@Override
public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) {
super.onSteppedOn(world_1, blockPos_1, entity_1);
try {
this.getBase().onSteppedOn(world_1, blockPos_1, entity_1);
} catch (IllegalArgumentException ignored) {}
}

@Override
public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) {
super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1);
try {
this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1);
} catch (IllegalArgumentException ignored) {}
}

@Override
public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) {
try {
boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1);
return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1);
} catch (IllegalArgumentException ignored) {
return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1);
}
}

@Override
public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) {
super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1);
try {
this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1);
} catch (IllegalArgumentException ignored) {}
}

@Environment(EnvType.CLIENT)
Expand Down
115 changes: 84 additions & 31 deletions src/main/java/com/shnupbups/extrapieces/blocks/CornerPieceBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,59 +100,112 @@ public VoxelShape getOutlineShape(BlockState blockState_1, BlockView blockView_1
return NORTH_SHAPE;
}
}

@Environment(EnvType.CLIENT)
@Override
public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) {
this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1);
super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1);
try {
this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) {
this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1);
super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1);
try {
this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) {
this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1);
super.onBroken(iWorld_1, blockPos_1, blockState_1);
try {
this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public float getBlastResistance() {
return this.set.getBase().getBlastResistance();
try {
return this.getBase().getBlastResistance();
} catch (IllegalArgumentException ignored) {
return super.getBlastResistance();
}
}


@Override
public BlockRenderLayer getRenderLayer() {
return this.set.getBase().getRenderLayer();
try {
return this.getBase().getRenderLayer();
} catch (IllegalArgumentException ignored) {
return super.getRenderLayer();
}
}


@Override
public int getTickRate(ViewableWorld viewableWorld_1) {
return this.set.getBase().getTickRate(viewableWorld_1);
}

public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) {
if (blockState_1.getBlock() != blockState_1.getBlock()) {
this.set.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false);
this.set.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false);
try {
return this.getBase().getTickRate(viewableWorld_1);
} catch (IllegalArgumentException ignored) {
return super.getTickRate(viewableWorld_1);
}
}


@Override
public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) {
super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1);
try {
if (blockState_1.getBlock() != blockState_1.getBlock()) {
this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false);
this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false);
}
} catch (IllegalArgumentException ignored) {}
}

@Override
public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) {
if (blockState_1.getBlock() != blockState_2.getBlock()) {
this.set.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1);
}
}

super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1);
try {
if (blockState_1.getBlock() != blockState_2.getBlock()) {
this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1);
}
} catch (IllegalArgumentException ignored) {}
}

@Override
public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) {
this.set.getBase().onSteppedOn(world_1, blockPos_1, entity_1);
super.onSteppedOn(world_1, blockPos_1, entity_1);
try {
this.getBase().onSteppedOn(world_1, blockPos_1, entity_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) {
this.set.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1);
super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1);
try {
this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1);
} catch (IllegalArgumentException ignored) {}
}


@Override
public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) {
return this.set.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1);
try {
boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1);
return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1);
} catch (IllegalArgumentException ignored) {
return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1);
}
}


@Override
public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) {
this.set.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1);
super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1);
try {
this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1);
} catch (IllegalArgumentException ignored) {}
}

public BlockState getPlacementState(ItemPlacementContext itemPlacementContext_1) {
Expand Down
Loading

0 comments on commit 5494b5b

Please sign in to comment.