Skip to content

Commit

Permalink
Fix CustomInfluenceableBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Jan 1, 2024
1 parent 48ca18a commit 7d43461
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mmodding.mmodding_lib.library.blocks;

import com.mmodding.mmodding_lib.library.utils.ObjectUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
Expand All @@ -17,10 +16,7 @@

public abstract class CustomInfluenceableBlock<E extends Enum<E> & StringIdentifiable> extends CustomBlock {

private E defaultValue = null;

protected EnumProperty<E> createInfluenceProperty(Class<E> type, E defaultValue) {
this.defaultValue = defaultValue;
public static <E extends Enum<E> & StringIdentifiable> EnumProperty<E> createInfluenceProperty(Class<E> type) {
return EnumProperty.of("influence", type);
}

Expand All @@ -40,10 +36,6 @@ public CustomInfluenceableBlock(Settings settings, boolean hasItem, ItemGroup it

public CustomInfluenceableBlock(Settings settings, boolean hasItem, Item.Settings itemSettings) {
super(settings, hasItem, itemSettings);
this.setDefaultState(this.getDefaultState().with(
this.getInfluenceProperty(),
ObjectUtils.assumeNotNull(this.defaultValue, () -> new IllegalStateException("Influence Property Default Value Not Defined"))
));
}

@Override
Expand All @@ -62,7 +54,5 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
builder.add(this.getInfluenceProperty());
}

public E getInfluence(BlockState state) {
return state.get(this.getInfluenceProperty());
}
public abstract E getInfluence(BlockState state);
}

0 comments on commit 7d43461

Please sign in to comment.